BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jimksas
Calcite | Level 5

/*If i have to pull out strings like below from a complete log file - do we have any method to do it?

NOTE: The data set work.test has 100 observations and 10 variables.

NOTE: The data set market.test2 has 500 observation and 50 variables.

*/

/*just a thought*/

filename logfile 'c:\test.log';

%let a=work | market;

%let b=any character;

%let c=any number;

%macro check;

        if string in : ("NOTE: The data set &a.&b &c &b &c &b") then

   do;

       data test;

         length string $100;

         infile logfile;

         string="NOTE: The data set &a.&b &c &b &c &b";

       run;

      proc sql;

          select loginfo into :string separated by ' ' from test;

      quit;

  end;

%mend;

%check;

        

/*thanks*/

Cynthia_sas
SAS Super FREQ


Hi:

  I'm not sure you have the macro code correct. Your macro variables are not doing what you think they are going to do. Try this test:

%let a=work | market;

%let b=any character;

%let c=any number;

%macro check;

  %put NOTE: The data set &a.&b &c &b &c &b;

%mend;

%check;

and then look in the SAS log (see screen shot). Have you tried to actually RUN your code???? Your IF statement is incorrect.

cynthia


what_are_macro_vars_going_to_produce.png
jimksas
Calcite | Level 5

Cynthia - i mentioned in my comment that this is just thought - I am not expert at all on macro, i am at very beginning stage in macro as well as SAS. I just wanted to know if somehow we can pull those particular strings

(

NOTE: The data set work.test has 100 observations and 10 variables.

NOTE: The data set market.test2 has 500 observation and 50 variables.

)

from log.

- Thanks for your time!!!

ChrisHemedinger
Community Manager

If the goal is to create a summary of "net data sets created/modified" by the current program, then perhaps you could instrument your program for this.  Here's an approach that uses the data table datetime stamp to detect which tables were modified after a given point in time (captured at the program start):

libname perm "c:\temp";

/* start the timer ... NOW! */
%let cutoff = %sysfunc(datetime());

/* create some tables in various libraries */
data perm.a perm.b perm.c work.ignore;
  set sashelp.class;
run;

/* create a table with entries for */
/* each table created since the program started */
proc sql;
create table net_tables as
select * from sashelp.vtable t1
where t1.modate > &cutoff
and libname not in ('WORK' 'SASHELP' 'MAPS' /* additional libraries to "ignore" */);
quit;

Make sense?

Chris

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
jimksas
Calcite | Level 5

WOW Chris Smiley Happy... Smiley Happy... Smiley Happy this is awesome...This will definitely help. I didn't think someone would come up with just 2 steps to fulfill this requirement.

Thanks a lot...!!! i really appreciate your time...!!!

I will drop unwanted variables from "net_tables"...

- Thanks Again Chris.

- Thanks ALL for your time and comments.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 19 replies
  • 4587 views
  • 3 likes
  • 7 in conversation