DATA Step, Macro, Functions and more

How to save macro to a dataset?

Reply
Occasional Contributor
Posts: 8

How to save macro to a dataset?

Hi, how do I save macro to a dataset, and export it to excel? 

The export part is easy and I know, but I couldn't figure out how to save macro to a dataset [not a catalog, proc export doesn't work with catalogs]

Thank you. 

Respected Advisor
Posts: 3,277

Re: How to save macro to a dataset?


jint83 wrote:

Hi, how do I save macro to a dataset, and export it to excel? 

The export part is easy and I know, but I couldn't figure out how to save macro to a dataset [not a catalog, proc export doesn't work with catalogs]

Thank you. 


This is very unclear. There is no real way to save a macro in a dataset except as a long string of text, and there's no point in doing that. Could you explain in more detail what you want to do with this macro? (Normally macros are saved in .sas programs, you don't need to do anything more than that). There's absolutely no point to export a SAS macro to Excel.

--
Paige Miller
Occasional Contributor
Posts: 8

Re: How to save macro to a dataset?

Posted in reply to PaigeMiller

As a long string of text, delimetered, is fine. 

This is needed since proc glmselect outputs its selected predictors as a macro:_GLSIND1 , as indicated in:

https://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#statug_glmselect_s...

 

I need the selected predictors outputed in an excel or text or as a string.

Super User
Posts: 2,061

Re: How to save macro to a dataset?

Play with sashelp.vmacro view

 

data want;

set sashelp.vmacro;

run;

 

filter the sashelp.vmacro  dictionary view however you like. HTH

 

Ask a Question
Discussion stats
  • 3 replies
  • 153 views
  • 0 likes
  • 3 in conversation