SlideShare a Scribd company logo
1 of 10
SAS macro to Create / Remove a PC Directory... Here's a SAS macro to Create and Remove a PC Directory... Often we ignore Notes and warning in the SAS log when we try to create/remove a directory that does/doesn't exist...This macro first checks for the existence of the directory and then create/delete it or else put a message to the SAS log...try it out :-) /* Macro to Create a directory */ %macro CheckandCreateDir(dir);     options noxwait;     %local rc fileref ;     %let rc = %sysfunc(filename(fileref,&dir)) ;        %if %sysfunc(fexist(&fileref)) %then        %put The directory 
&dir
 already exists ;     %else       %do ;           %sysexec mkdir 
&dir
 ;           %if &sysrc eq 0 %then %put The directory &dir has been created. ;  Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-remove-pc-directory.html  Ways to Count the Number of Obs in a dataset and pass it into a macro variable... Well...there are many ways of getting the observation count into a macro variable...but there a few pros and cons in those methods...1. using sql with count(*)..  eg.         proc sql;              select count(*) into :macvar             from dsn;         quit; pros: simple to understand and develop cons: you need to read the dataset in its entirety which requires processing power here...2. datastep  eg.        data new;          set old nobs=num;          call symputx('macvar',num);       run; Read more @ http://sastechies.blogspot.com/2009/11/ways-to-count-number-of-obs-in-dataset.html  SAS macro to split dataset by the number of Observations specified Suppose there was a large dataset....This SAS macro program splits the dataset by the number of observations mentioned...macro name%split(DatasetName, No ofobservation to split by)/* creating a dataset with 100000 observations*/ data dsn; do i=1 to 100000; output; end; run; %macro split(dsn,splitby); data _null_; set &dsn nobs=num; Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-split-dataset-by-number-of.html  SAS macro to reorder dataset variables in alphabetic order... How do you reorder variables in a dataset...I get this many a times....  Here's a macro for you to achieve it...For example I've used a dataset sashelp.flags and created some more variables with variety of variables with names upper / lower cases and _'s to demonstrate the reorder macro....   Please try this macro for yourself and let me know your suggestions....   /* Example dataset with variety of variable names */    data flags;  set sashelp.flags;  a=2;  b=4;  Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-reorder-dataset-variables.html Use SAS function Propcase() to streamline Google Contacts You might think I am crazy...but I have been using this macro for a long time to fix some contacts in my Google Contacts...I get a little irritated when I can't find a particular person by email...so I wrote this macro...This macro takes for Input a .csv file that is exported from Google Contacts and outputs a file that is ready to be imported to Google Contacts....often I wanted to have Names in the proper case...Try it yourself and let me know if it needs any tweaks...Propcase in SAS Documentation. %macro organizeGoogleContacts(infile,outfile); /*Import your contacts into SAS */  data googlegroups; infile 
&infile
 dlm=',' dsd lrecl=32767 firstobs=2; Read more @ http://sastechies.blogspot.com/2009/11/use-sas-function-propcase-to-streamline.html   SAS Macro to Create a delimited text file from a SAS dataset... A document that discusses SAS Macro to Create a delimited text file from a SAS data set..  options mprint;   data one;   input id name :$20. amount ;   date=today();   format amount dollar10.2             date mmddyy10.;   label id=
Customer ID Number
; datalines; 1 Grant   57.23 2 Michael 45.68 3 Tammy   53.21 ; Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-create-delimited-text-file.html  SAS Macro to split a dataset into multiple datasets vertically with a common primary key This macro splits a dataset to multiple datasets vertically with a common primary key. For eg, a dataset has 400 fields and 20,000 records. If we can split the dataset into two, with 200 fields and 20,000 records in each dataset with a common field like loan number as primary key would be helpful to load the details for analysis.   /** To be called like this... %splitdsnverticallykey(dsn,varperdsn,keyvars=); eg. %splitdsnverticallykey(sashelp.vtable,4,keyvars=memname libname);   Where -----------   dsn - libname.datasetname to be split varperdsn - How many vars per dsn excluding the key variables keyvars - specify the primary key variables */  Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-split-dataset-into.html  SAS Macro that reads the filenames  available at a particular directory on any FTP server (i.e. Windows Network  Drive/Unix/Mainframe) Here's a macro that reads the filenames available at a particular directory on any FTP server (i.e. Windows Network Drive/Unix/Mainframe)... For Windows network drives we use the Filename Pipe Statement For Mainframe and Unix we use the FileName FTP protocol statement. For further reference please refer to Filename statements in SAS Documentation. First we need to create 2 Excel files  ServerList.xls – 3 columns with servertype | host | sourcedir Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-that-lists-files-at.html
SAS Macro to Split Dataset Vertically with Common Key
SAS Macro to Split Dataset Vertically with Common Key
SAS Macro to Split Dataset Vertically with Common Key
SAS Macro to Split Dataset Vertically with Common Key
SAS Macro to Split Dataset Vertically with Common Key
SAS Macro to Split Dataset Vertically with Common Key
SAS Macro to Split Dataset Vertically with Common Key
SAS Macro to Split Dataset Vertically with Common Key
SAS Macro to Split Dataset Vertically with Common Key

More Related Content

What's hot

SAS Macros part 1
SAS Macros part 1SAS Macros part 1
SAS Macros part 1venkatam
 
SAS cheat sheet
SAS cheat sheetSAS cheat sheet
SAS cheat sheetAli Ajouz
 
SAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSrinimf-Slides
 
Basics Of SAS Programming Language
Basics Of SAS Programming LanguageBasics Of SAS Programming Language
Basics Of SAS Programming Languageguest2160992
 
Data Match Merging in SAS
Data Match Merging in SASData Match Merging in SAS
Data Match Merging in SASguest2160992
 
Introduction to SAS Data Set Options
Introduction to SAS Data Set OptionsIntroduction to SAS Data Set Options
Introduction to SAS Data Set OptionsMark Tabladillo
 
Improving Effeciency with Options in SAS
Improving Effeciency with Options in SASImproving Effeciency with Options in SAS
Improving Effeciency with Options in SASguest2160992
 
Utility Procedures in SAS
Utility Procedures in SASUtility Procedures in SAS
Utility Procedures in SASguest2160992
 
Understanding sas data step processing.
Understanding sas data step processing.Understanding sas data step processing.
Understanding sas data step processing.Ravi Mandal, MBA
 
SAS Macros part 4.1
SAS Macros part 4.1SAS Macros part 4.1
SAS Macros part 4.1venkatam
 
Base SAS Full Sample Paper
Base SAS Full Sample Paper Base SAS Full Sample Paper
Base SAS Full Sample Paper Jimmy Rana
 
SAS Macros part 2
SAS Macros part 2SAS Macros part 2
SAS Macros part 2venkatam
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SASizahn
 
SAS Macros part 3
SAS Macros part 3SAS Macros part 3
SAS Macros part 3venkatam
 
A Step-By-Step Introduction to SAS Report Procedure
A Step-By-Step Introduction to SAS Report ProcedureA Step-By-Step Introduction to SAS Report Procedure
A Step-By-Step Introduction to SAS Report ProcedureYesAnalytics
 

What's hot (20)

SAS Macros part 1
SAS Macros part 1SAS Macros part 1
SAS Macros part 1
 
SAS cheat sheet
SAS cheat sheetSAS cheat sheet
SAS cheat sheet
 
SAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSAS Mainframe -Program-Tips
SAS Mainframe -Program-Tips
 
Basics Of SAS Programming Language
Basics Of SAS Programming LanguageBasics Of SAS Programming Language
Basics Of SAS Programming Language
 
Data Match Merging in SAS
Data Match Merging in SASData Match Merging in SAS
Data Match Merging in SAS
 
Introduction to SAS Data Set Options
Introduction to SAS Data Set OptionsIntroduction to SAS Data Set Options
Introduction to SAS Data Set Options
 
Improving Effeciency with Options in SAS
Improving Effeciency with Options in SASImproving Effeciency with Options in SAS
Improving Effeciency with Options in SAS
 
Utility Procedures in SAS
Utility Procedures in SASUtility Procedures in SAS
Utility Procedures in SAS
 
Understanding sas data step processing.
Understanding sas data step processing.Understanding sas data step processing.
Understanding sas data step processing.
 
SAS Macros part 4.1
SAS Macros part 4.1SAS Macros part 4.1
SAS Macros part 4.1
 
Base SAS Full Sample Paper
Base SAS Full Sample Paper Base SAS Full Sample Paper
Base SAS Full Sample Paper
 
SAS Macros part 2
SAS Macros part 2SAS Macros part 2
SAS Macros part 2
 
SAS ODS HTML
SAS ODS HTMLSAS ODS HTML
SAS ODS HTML
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SAS
 
SAS - Training
SAS - Training SAS - Training
SAS - Training
 
SAS BASICS
SAS BASICSSAS BASICS
SAS BASICS
 
SAS Macros part 3
SAS Macros part 3SAS Macros part 3
SAS Macros part 3
 
A Step-By-Step Introduction to SAS Report Procedure
A Step-By-Step Introduction to SAS Report ProcedureA Step-By-Step Introduction to SAS Report Procedure
A Step-By-Step Introduction to SAS Report Procedure
 
Sas summary guide
Sas summary guideSas summary guide
Sas summary guide
 
INTRODUCTION TO SAS
INTRODUCTION TO SASINTRODUCTION TO SAS
INTRODUCTION TO SAS
 

Viewers also liked

Base SAS Exam Questions
Base SAS Exam QuestionsBase SAS Exam Questions
Base SAS Exam Questionsguestc45097
 
MACRO ENVIRONMENT BY JEET PAREKH
MACRO ENVIRONMENT BY JEET PAREKHMACRO ENVIRONMENT BY JEET PAREKH
MACRO ENVIRONMENT BY JEET PAREKHSameer Mathur
 
MANAGING MARKETS - Macro Environmental Forces and Marketing Mix / Commonwealt...
MANAGING MARKETS - Macro Environmental Forces and Marketing Mix / Commonwealt...MANAGING MARKETS - Macro Environmental Forces and Marketing Mix / Commonwealt...
MANAGING MARKETS - Macro Environmental Forces and Marketing Mix / Commonwealt...Tolga Koymen
 
Marketing management
Marketing managementMarketing management
Marketing managementJYOTI21IIBM
 
Interviewing Basics
Interviewing BasicsInterviewing Basics
Interviewing Basicsdkaltved
 
Approximating_probability_density_functions_for_the_Collective_Risk_Model
Approximating_probability_density_functions_for_the_Collective_Risk_ModelApproximating_probability_density_functions_for_the_Collective_Risk_Model
Approximating_probability_density_functions_for_the_Collective_Risk_ModelHarini Vaidyanath
 

Viewers also liked (12)

SAS Proc SQL
SAS Proc SQLSAS Proc SQL
SAS Proc SQL
 
Proc sql tips
Proc sql tipsProc sql tips
Proc sql tips
 
Base SAS Exam Questions
Base SAS Exam QuestionsBase SAS Exam Questions
Base SAS Exam Questions
 
MACRO ENVIRONMENT BY JEET PAREKH
MACRO ENVIRONMENT BY JEET PAREKHMACRO ENVIRONMENT BY JEET PAREKH
MACRO ENVIRONMENT BY JEET PAREKH
 
MANAGING MARKETS - Macro Environmental Forces and Marketing Mix / Commonwealt...
MANAGING MARKETS - Macro Environmental Forces and Marketing Mix / Commonwealt...MANAGING MARKETS - Macro Environmental Forces and Marketing Mix / Commonwealt...
MANAGING MARKETS - Macro Environmental Forces and Marketing Mix / Commonwealt...
 
Marketing management
Marketing managementMarketing management
Marketing management
 
Micro marketing environment
Micro marketing environmentMicro marketing environment
Micro marketing environment
 
SAS Functions
SAS FunctionsSAS Functions
SAS Functions
 
Arrays in SAS
Arrays in SASArrays in SAS
Arrays in SAS
 
SAS TRAINING
SAS TRAININGSAS TRAINING
SAS TRAINING
 
Interviewing Basics
Interviewing BasicsInterviewing Basics
Interviewing Basics
 
Approximating_probability_density_functions_for_the_Collective_Risk_Model
Approximating_probability_density_functions_for_the_Collective_Risk_ModelApproximating_probability_density_functions_for_the_Collective_Risk_Model
Approximating_probability_density_functions_for_the_Collective_Risk_Model
 

Similar to SAS Macro to Split Dataset Vertically with Common Key

Quick Guide to Refresh Spark skills
Quick Guide to Refresh Spark skillsQuick Guide to Refresh Spark skills
Quick Guide to Refresh Spark skillsRavindra kumar
 
Data handling in r
Data handling in rData handling in r
Data handling in rAbhik Seal
 
[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...Functional Thursday
 
A Little Backbone For Your App
A Little Backbone For Your AppA Little Backbone For Your App
A Little Backbone For Your AppLuca Mearelli
 
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...DataStax
 
Compass Framework
Compass FrameworkCompass Framework
Compass FrameworkLukas Vlcek
 
Twig Brief, Tips&Tricks
Twig Brief, Tips&TricksTwig Brief, Tips&Tricks
Twig Brief, Tips&TricksAndrei Burian
 
This upload requires better support for ODP format
This upload requires better support for ODP formatThis upload requires better support for ODP format
This upload requires better support for ODP formatForest Mars
 
Salesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command lineSalesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command lineCyrille Coeurjoly
 
Website Security
Website SecurityWebsite Security
Website SecurityCarlos Z
 
Website Security
Website SecurityWebsite Security
Website SecurityMODxpo
 
Python (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationPython (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationRick Sherman
 
RubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendallRubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendalltutorialsruby
 
RubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendallRubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendalltutorialsruby
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 
Finding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeFinding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeBen Marks
 
Cassandra & puppet, scaling data at $15 per month
Cassandra & puppet, scaling data at $15 per monthCassandra & puppet, scaling data at $15 per month
Cassandra & puppet, scaling data at $15 per monthdaveconnors
 
4Developers 2018: Pyt(h)on vs słoń: aktualny stan przetwarzania dużych danych...
4Developers 2018: Pyt(h)on vs słoń: aktualny stan przetwarzania dużych danych...4Developers 2018: Pyt(h)on vs słoń: aktualny stan przetwarzania dużych danych...
4Developers 2018: Pyt(h)on vs słoń: aktualny stan przetwarzania dużych danych...PROIDEA
 

Similar to SAS Macro to Split Dataset Vertically with Common Key (20)

Quick Guide to Refresh Spark skills
Quick Guide to Refresh Spark skillsQuick Guide to Refresh Spark skills
Quick Guide to Refresh Spark skills
 
Data handling in r
Data handling in rData handling in r
Data handling in r
 
[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...
 
A Little Backbone For Your App
A Little Backbone For Your AppA Little Backbone For Your App
A Little Backbone For Your App
 
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
 
Compass Framework
Compass FrameworkCompass Framework
Compass Framework
 
R stata
R stataR stata
R stata
 
Twig Brief, Tips&Tricks
Twig Brief, Tips&TricksTwig Brief, Tips&Tricks
Twig Brief, Tips&Tricks
 
This upload requires better support for ODP format
This upload requires better support for ODP formatThis upload requires better support for ODP format
This upload requires better support for ODP format
 
Salesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command lineSalesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command line
 
Mongo-Drupal
Mongo-DrupalMongo-Drupal
Mongo-Drupal
 
Website Security
Website SecurityWebsite Security
Website Security
 
Website Security
Website SecurityWebsite Security
Website Security
 
Python (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationPython (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network Automation
 
RubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendallRubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendall
 
RubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendallRubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendall
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
Finding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento CodeFinding Your Way: Understanding Magento Code
Finding Your Way: Understanding Magento Code
 
Cassandra & puppet, scaling data at $15 per month
Cassandra & puppet, scaling data at $15 per monthCassandra & puppet, scaling data at $15 per month
Cassandra & puppet, scaling data at $15 per month
 
4Developers 2018: Pyt(h)on vs słoń: aktualny stan przetwarzania dużych danych...
4Developers 2018: Pyt(h)on vs słoń: aktualny stan przetwarzania dużych danych...4Developers 2018: Pyt(h)on vs słoń: aktualny stan przetwarzania dużych danych...
4Developers 2018: Pyt(h)on vs słoń: aktualny stan przetwarzania dużych danych...
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 

SAS Macro to Split Dataset Vertically with Common Key

  • 1. SAS macro to Create / Remove a PC Directory... Here's a SAS macro to Create and Remove a PC Directory... Often we ignore Notes and warning in the SAS log when we try to create/remove a directory that does/doesn't exist...This macro first checks for the existence of the directory and then create/delete it or else put a message to the SAS log...try it out :-) /* Macro to Create a directory */ %macro CheckandCreateDir(dir);    options noxwait;    %local rc fileref ;    %let rc = %sysfunc(filename(fileref,&dir)) ;       %if %sysfunc(fexist(&fileref)) %then       %put The directory &dir already exists ;    %else      %do ;          %sysexec mkdir &dir ;          %if &sysrc eq 0 %then %put The directory &dir has been created. ; Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-remove-pc-directory.html Ways to Count the Number of Obs in a dataset and pass it into a macro variable... Well...there are many ways of getting the observation count into a macro variable...but there a few pros and cons in those methods...1. using sql with count(*)..  eg.         proc sql;              select count(*) into :macvar             from dsn;         quit; pros: simple to understand and develop cons: you need to read the dataset in its entirety which requires processing power here...2. datastep  eg.        data new;          set old nobs=num;          call symputx('macvar',num);       run; Read more @ http://sastechies.blogspot.com/2009/11/ways-to-count-number-of-obs-in-dataset.html SAS macro to split dataset by the number of Observations specified Suppose there was a large dataset....This SAS macro program splits the dataset by the number of observations mentioned...macro name%split(DatasetName, No ofobservation to split by)/* creating a dataset with 100000 observations*/ data dsn; do i=1 to 100000; output; end; run; %macro split(dsn,splitby); data _null_; set &dsn nobs=num; Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-split-dataset-by-number-of.html SAS macro to reorder dataset variables in alphabetic order... How do you reorder variables in a dataset...I get this many a times.... Here's a macro for you to achieve it...For example I've used a dataset sashelp.flags and created some more variables with variety of variables with names upper / lower cases and _'s to demonstrate the reorder macro....   Please try this macro for yourself and let me know your suggestions....   /* Example dataset with variety of variable names */   data flags; set sashelp.flags; a=2; b=4; Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-reorder-dataset-variables.html Use SAS function Propcase() to streamline Google Contacts You might think I am crazy...but I have been using this macro for a long time to fix some contacts in my Google Contacts...I get a little irritated when I can't find a particular person by email...so I wrote this macro...This macro takes for Input a .csv file that is exported from Google Contacts and outputs a file that is ready to be imported to Google Contacts....often I wanted to have Names in the proper case...Try it yourself and let me know if it needs any tweaks...Propcase in SAS Documentation. %macro organizeGoogleContacts(infile,outfile); /*Import your contacts into SAS */ data googlegroups; infile &infile dlm=',' dsd lrecl=32767 firstobs=2; Read more @ http://sastechies.blogspot.com/2009/11/use-sas-function-propcase-to-streamline.html SAS Macro to Create a delimited text file from a SAS dataset... A document that discusses SAS Macro to Create a delimited text file from a SAS data set.. options mprint;   data one;   input id name :$20. amount ;   date=today();   format amount dollar10.2            date mmddyy10.;   label id= Customer ID Number ; datalines; 1 Grant   57.23 2 Michael 45.68 3 Tammy   53.21 ; Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-create-delimited-text-file.html SAS Macro to split a dataset into multiple datasets vertically with a common primary key This macro splits a dataset to multiple datasets vertically with a common primary key. For eg, a dataset has 400 fields and 20,000 records. If we can split the dataset into two, with 200 fields and 20,000 records in each dataset with a common field like loan number as primary key would be helpful to load the details for analysis.   /** To be called like this... %splitdsnverticallykey(dsn,varperdsn,keyvars=); eg. %splitdsnverticallykey(sashelp.vtable,4,keyvars=memname libname);   Where -----------   dsn - libname.datasetname to be split varperdsn - How many vars per dsn excluding the key variables keyvars - specify the primary key variables */ Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-to-split-dataset-into.html SAS Macro that reads the filenames available at a particular directory on any FTP server (i.e. Windows Network Drive/Unix/Mainframe) Here's a macro that reads the filenames available at a particular directory on any FTP server (i.e. Windows Network Drive/Unix/Mainframe)... For Windows network drives we use the Filename Pipe Statement For Mainframe and Unix we use the FileName FTP protocol statement. For further reference please refer to Filename statements in SAS Documentation. First we need to create 2 Excel files ServerList.xls – 3 columns with servertype | host | sourcedir Read more @ http://sastechies.blogspot.com/2009/11/sas-macro-that-lists-files-at.html