BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DBAgFinance
Fluorite | Level 6

Does anyone know how to use a prompted value to select an existing table in a SAS program using EG.  In the example below I am trying to create a table from the values in the table fact_qtr1_year2015.  Can a prompted value be used in a table name.

Example:

Proc SQL;

     Create table work.example as

     select    company,

               portfolio,

               balance

     From libname.Fact_qtr(prompted value)_year(prompted value)

Quit;

run;

   




1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

The results from user defined prompts in Enterprise Guide are stored in macro variables. So your final "from" would look like this:

From libname.Fact_qtr&qtr._year&year

Note the dot after the first reference to a macro variable; this is necessary so that the macro processor knows it must look for &qtr and not for &qtr_year.

The actual macro variable names depend on the definition of your prompts.

View solution in original post

3 REPLIES 3
slchen
Lapis Lazuli | Level 10

You could try to define prompted value as macro variable, such as:

%let qtr=1;

%let year=2015;

Proc SQL;

     Create table work.example as

     select    company,

               portfolio,

               balance

     From libname.Fact_qtr&qut._year&year;

Quit;

DBAgFinance
Fluorite | Level 6

Thank you for the help.  Worked great

Kurt_Bremser
Super User

The results from user defined prompts in Enterprise Guide are stored in macro variables. So your final "from" would look like this:

From libname.Fact_qtr&qtr._year&year

Note the dot after the first reference to a macro variable; this is necessary so that the macro processor knows it must look for &qtr and not for &qtr_year.

The actual macro variable names depend on the definition of your prompts.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2754 views
  • 2 likes
  • 3 in conversation