DATA Step, Macro, Functions and more

How to Converting OS command output results into SAS data sets

Accepted Solution Solved
Reply
Contributor VDD
Contributor
Posts: 22
Accepted Solution

How to Converting OS command output results into SAS data sets

Please assist or point me to some good examples for working with OS commands and converting those results into usable SAS dataset results. 

What I am trying to do is work with SAS and the OS commands to review changes in programs and data over time which works as expected to this point.  What I am expecting is a SAS dataset for each time that contains results from changes found by the OS command output results contains information.   the information is used after this process but currently I am saving the SAS log as text and working with that.

This is the macro produces and an example of the output from a SAS log after the macro has been called included under the macro below.

%macro changed_sas;
 data _null_;
  infile oscmd;
  input;
  put _infile_;
 run;
%mend changed_sas;

 

***** C:\TEST\CREATE.SAS

   74:

   75:  %let Month1 = 200001;

   76:  %let MonthN = 201803;

   77:  %let update = D;

   78:

***** D:\TEST\CREATE.SAS

   74:

   75:  %let Month1 = 200001;

   76:  %let MonthN = 201712;

   77:  %let update = N;

   78:

*****

 

 

 

 

 

 


Accepted Solutions
Solution
‎03-08-2018 12:17 PM
Contributor VDD
Contributor
Posts: 22

Re: How to Converting OS command output results into SAS data sets

thank you everyone

I needed to replace _null_ with a name and then put statement needed to be replaced with myvar.

data test;

infile oscmd;

input;

 

myvar= _infile_;

run;

 

View solution in original post


All Replies
Super User
Posts: 22,844

Re: How to Converting OS command output results into SAS data sets

Rather than build your own version control system can you use Git or an established version control system? There are several log and code parsers available from users, if you check lexjansen.com and there's also PROC SCAPROC to trace procedures.
Super User
Posts: 9,560

Re: How to Converting OS command output results into SAS data sets

And what information should end up in the dataset?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Contributor VDD
Contributor
Posts: 22

Re: How to Converting OS command output results into SAS data sets

Posted in reply to KurtBremser

What I am expecting is the results in a SAS dataset's based on SAS calling OSCMD and getting output resulted from the DOS command such as FC, DIR ...  As an example.  I know that GIT works, but what I am looking for is analyzable SAS datasets that are results which are due to changes in SAS programs and SAS datasets, underplaying depended documents related to policies and such over a long time period that involves many changes to each program area under evaluation.

 

Solution
‎03-08-2018 12:17 PM
Contributor VDD
Contributor
Posts: 22

Re: How to Converting OS command output results into SAS data sets

thank you everyone

I needed to replace _null_ with a name and then put statement needed to be replaced with myvar.

data test;

infile oscmd;

input;

 

myvar= _infile_;

run;

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 89 views
  • 0 likes
  • 3 in conversation