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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
thorneton
Fluorite | Level 6

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

1 REPLY 1
thorneton
Fluorite | Level 6

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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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