Desktop productivity for business analysts and programmers

PROC SQL using a macro variable for label name in a table.

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

PROC SQL using a macro variable for label name in a table.

I'm trying to name my labels in a table that I created what was entered as a prompt.  I'm prompting for a date range (FromDate ToDate).  Then within my code I'm using these variables to grab the information.  When I create my table I want to use the FromDate and ToDate to label the fields.

 

Prompt field: FromDate as a value of 2014

Prompt field: ToDate as a value of 2015

 

PROC SQL;

CREATE TABLE MyTable AS

Select field1 as field1_2014, field2 as field2_2014, field3 as field3_2014

    , field3 as field4_2015, field5 as field5_2015, field6 as field6_2015

 

Is this possible?


Accepted Solutions
Solution
‎05-05-2016 08:55 AM
Occasional Contributor
Posts: 6

Re: PROC SQL using a macro variable for label name in a table.

The macro variable names assigned to the date prompt or the the date range prompt will be listed in the log.  Field1 is read via the from statement, field1 can assigned a new name with a date suffix.    Field1 as field1_&FromDate.  The contents of the macro variable &FromDate will be appended to the string field1  --- creating the field name "field1_ 2014 (from your example). Hope this is the question you were asking😉  Date prompt string is 9 characters,  ddmmmyyyy -- 05MAY2016

View solution in original post


All Replies
Solution
‎05-05-2016 08:55 AM
Occasional Contributor
Posts: 6

Re: PROC SQL using a macro variable for label name in a table.

The macro variable names assigned to the date prompt or the the date range prompt will be listed in the log.  Field1 is read via the from statement, field1 can assigned a new name with a date suffix.    Field1 as field1_&FromDate.  The contents of the macro variable &FromDate will be appended to the string field1  --- creating the field name "field1_ 2014 (from your example). Hope this is the question you were asking😉  Date prompt string is 9 characters,  ddmmmyyyy -- 05MAY2016

☑ This topic is SOLVED.

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

Discussion stats
  • 1 reply
  • 247 views
  • 0 likes
  • 2 in conversation