Help using Base SAS procedures

Can you automate substitution of dependant variable in the model statement?

Reply
N/A
Posts: 0

Can you automate substitution of dependant variable in the model statement?

Hi all. I'm trying to find a way to speed up SAS analysis by minimizing the amount of manual labour.

Let's say you have a very simple code like below:


proc mixed data = mydata;
class stand_type;
model total_mg = stand_type;
run;


I'm trying to find a way to automatically substitute "total_mg" in the model statement with other variables (e.g., total_c, total_n, total_k etc.) found in the same dataset so that I only have to execute the program once, and all the variables in MYDATA is analysed by the proc mixed model provided.

Thanks in advance for your help!
SAS Super FREQ
Posts: 8,743

Re: Can you automate substitution of dependant variable in the model statement?

Hi:
Anytime you talk about "automating" SAS code, you get, eventually, to advice about using the SAS Macro Facility. For a good overview of the SAS macro facility, this is an excellent place to start:
http://www2.sas.com/proceedings/sugi28/056-28.pdf

When you talk about generating a LIST of variable names, to be used in the automation process, you will get, eventually, to advice about using the SAS Dictionary Tables or the SASHELP.Vxxxxx tables.
http://www2.sas.com/proceedings/sugi26/p017-26.pdf
http://www2.sas.com/proceedings/sugi31/259-31.pdf
http://www2.sas.com/proceedings/sugi29/237-29.pdf (specifically Example 5)

This reading should get you pointed in the right direction. There have also been a lot of previous forum postings on the use of the DICTIONARY tables and on macro processing like this.

cynthia
N/A
Posts: 0

Re: Can you automate substitution of dependant variable in the model statement?

Great! Thanks for all your hard work!!
Ask a Question
Discussion stats
  • 2 replies
  • 103 views
  • 0 likes
  • 2 in conversation