10-07-2014 12:51 AM
1. Is there any way to get macro source code from the catalog?
session compiled macros: if we miss source code after creation of macro by mistake,how can we update the macro?
stored compiled macros: if we did not keep source option, then how to get the code for stored compiled macro?
Autocompiled macros: we have to keep source code.(no problem at all)
note: From format catalogs, we can do cntlout option to get the dataset from format and we can update the format and submit again.
10-07-2014 01:37 AM
10-07-2014 01:37 AM
10-07-2014 10:32 AM
I am using PC sas.
1. I submitted a macro and mistakenly closed my enhanced editor. then i got this question how to retrive macro code.(session compiled macros)
2 . Assumed there is no straight forward way to get the source of macro from catalog(stored compiled macros)
3. Not a question because we are keeping source code (we have to keep source code anyway)
if my assumption is wrong let me know and thanks for the reply.
10-08-2014 02:34 AM
Question 1: can we use macro functions in datastep (%scan,%sysfunc etc)
Question 2: need output datasets for list of values in a varible in a dataset. could you please correct the program.
*1. selecting all varible values from a varible in a table;
select distinct make into : makes separated by ' ' from sashelp.cars order by make;
*2.due to variable value mercedes-benz compressing and printing the values;
*3. sorting the dataset to get the different values of varibles one by one(group processing);
proc sort data=sashelp.cars out=cars;
*4. want to get each distinct value from varible and making output to corresponding dataset.
retain i 1;
if first.make then
output scan("&makes",i,' ');
10-08-2014 10:22 AM
You cannot dynamically generate the name of the output dataset during data step execution. You need to use macro code to generate separate OUTPUT statement for each table and then dynamically decide which output statement to execute.
So either you generate code like
data Acura Audi .... ;
set sashelp.cars ;
do select (make);
when('Acura') output acura;
when('Audi') output audi;
Or you could use one of the HASH object solutions. With those you can output a hash object to a table name that is generated dynamically (that is the vlaue of a run time variable).
Need further help from the community? Please ask a new question.