DATA Step, Macro, Functions and more

Input dataset path once in program, recall it many times

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

Input dataset path once in program, recall it many times

Hello,

I am trying to code a simple program in which the user inputs the libname then the dataset once and several proc's and data steps are used with this dataset.  I'd like to have the option for the user to block off portions of code to run one proc or one data set independently, so I can't put everything in one giant macro.  How can I have the user input the dataset location just once then have some sort of alias or another way of referring to this dataset multiple times?  Thanks for helping out a newbie!

-Charles


Accepted Solutions
Solution
‎09-30-2013 05:49 PM
Super User
Posts: 5,427

Re: Input dataset path once in program, recall it many times

Sorry, since you mentioned "giant macro" I asumed you were familiar with concept:

%Let myTab = MyLibref.MyLongTableNameIWant2Query;

proc print data=&MyTab.;

run;

Data never sleeps

View solution in original post


All Replies
Super User
Posts: 5,427

Re: Input dataset path once in program, recall it many times

Macro variable?

Data never sleeps
Occasional Contributor
Posts: 14

Re: Input dataset path once in program, recall it many times

I'm very new to SAS-- could you give me an example?  Thanks.

Super User
Posts: 19,789

Re: Input dataset path once in program, recall it many times

Statistical Computing Seminar: Introduction to SAS Macro Language

Not quite what you're looking for, but a good read to start off with.

Occasional Contributor
Posts: 14

Re: Input dataset path once in program, recall it many times

Thank you very much!  Macros are still unfamiliar territory as we didn't really cover them in Base SAS Programming... I appreciate the help.

Solution
‎09-30-2013 05:49 PM
Super User
Posts: 5,427

Re: Input dataset path once in program, recall it many times

Sorry, since you mentioned "giant macro" I asumed you were familiar with concept:

%Let myTab = MyLibref.MyLongTableNameIWant2Query;

proc print data=&MyTab.;

run;

Data never sleeps
Occasional Contributor
Posts: 14

Re: Input dataset path once in program, recall it many times

Thank you very much! 

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 279 views
  • 3 likes
  • 3 in conversation