I know if I put the following Proc Print in my code, it will print the data for the last dataset created (previous dataset):
Proc print;
run;
But what I'd really like to do is put that in a macro with that grabs the name of the last dataset created and puts it into a TITLE statement. Is there a way to know the name of the dataset that was created?
Thanks,
J
Have you tried using the automatically created macro variable: &sysdsn. ?
There are a lot of automatically created macro variables that capture things you might want. Take a look at: http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001071968.htm
Have you tried using the automatically created macro variable: &sysdsn. ?
There are a lot of automatically created macro variables that capture things you might want. Take a look at: http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001071968.htm
sysdsn
Haikuo
data class;
set sashelp.class;
proc print data=&syslast;
title from dataset &syslast;
run;
Thanks everyone...sysdsn and syslast both work great...they even include the libname used.
Interestingly, &syslast uses the format "libname.datasetname"
...where &sysdsn uses the format "libname datasetname"
HI Jason
One wish remains unfulfilled. To have a convenient subtitle reporting the data set used in the reporting procedure we still need to submit that subtitle statement.
I would quite like have a feature that resolves when the procedure executes and not just when the title(n) or footnote statement is submitted.
footnote3 "reporting from #latest_ds" ;
I chose the # prefix because something like this used #byVal
just thinking
Do you remember the super-duper PROC QPRINT. It had options to include DSName and or DSLabel in the output
vaguely I recall qprint not providing what I needed (at the time) and proc print, did so I restricted that bit of learning (sounds like the well prepared excuse it is).
However didn't qprint become fsprint? forerunner of fsview and fsreport (now proc report)?
there is an excellent certification proposed by ChrisH in his SASDummy blog back at the beginning of this month for which I do not wish to qualify!
😉
😉
Peter.C wrote:
vaguely I recall qprint not providing what I needed (at the time) and proc print, did so I restricted that bit of learning (sounds like the well prepared excuse it is).
It is quite possible that QPRINT did not provided what you needed at the time. I wouldn't know anything about that.
However didn't qprint become fsprint? forerunner of fsview and fsreport (now proc report)?
No.
data test;
x=1;
run;
title "Created &SYSLAST";
proc print; run;
PG
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.