BookmarkSubscribeRSS Feed
Jomar28
Calcite | Level 5

Good day.

 

I have a log's code that i am trimming to not show unnecessary data .

I want to split a step that was found example is attached

 

That whole step is shown in 1 column after the proc print.

How can i split it so it makes 2 columns under each other that looks like this

 

NOTE: The data set WORK.STUFF 

has 62 observations and 40 variables.

 

this is the start point of my code ATM

 

data want;
length input_ds $32767.;
infile "/home/jdebeer/stuff.log.txt" lrecl=32767 truncover;
input @1 input_ds $32767.;
if input_ds =: "NOTE: The data set" then do;
ds=scan(input_ds,5," ");
no_obs=scan(input_ds,7," ");
end;
if input_ds =: "NOTE: SAS initialization used:" then do;
siu=substr(input_ds,index(input_ds,":")+1,24);
end;
if input_ds =: "NOTE: PROCEDURE SQL" then do;
ps=substr(input_ds,index(input_ds,":")+1,14);
end;
if input_ds =: "NOTE: DATA statement used" then do;
dsm=substr(input_ds,index(input_ds,":")+1,15);
end;
if input_ds =: "NOTE: PROCEDURE FORMAT used" then do;
end;

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

What do you actually want to achieve from this?  You can control various output parts of a program either in the code or in the options.  If you need to find inputs/outputs and such like, then use proc scaproc which is a code analyzer, once the code is run with that running it provides a lot of information.  As for how to create new lines, you can control where the output occurs with the output statement, e.g.:

if input_ds =: "NOTE: The data set" then do;
  line=substr(input_ds,1,findw(input_ds,"has"));
  output;
  line=subsrt(input_ds,findw(input_ds,"has"));
  output;
end;

Will output a row for text up to the word has.  Then output another row for all text after the word has.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 894 views
  • 0 likes
  • 2 in conversation