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

I use Proc Transpose on a data set that results in column headers that are fiscal weeks.  The weeks extend back a year and are updated each week.  I would like to format the data in the new table without listing the new columns explicitly. 

I have several more queries after the transpose and refer to the transpose table columns using ' * '. 

Is there a way to format the VAR data?

 

 

 

ROC TRANSPOSE DATA=have OUT=want;
BY type_code;
VAR money_spent;
ID Fiscal_week;
RUN;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Add a PREFIX option to your date variables, say FW_ for fiscal week. Then you can shortcut reference them as FW_

Add IDLABEL option so that your labels are still what you want to see. 

 

 

ROC TRANSPOSE DATA=have OUT=want  PREFIX=FW_;
BY type_code;
VAR money_spent;
ID Fiscal_week;
IDLABEL Fiscal_Week;
RUN;

data WANT2;
set WANT;

format FW_: dollar24.;

run;

@yelkenli wrote:

I use Proc Transpose on a data set that results in column headers that are fiscal weeks.  The weeks extend back a year and are updated each week.  I would like to format the data in the new table without listing the new columns explicitly. 

I have several more queries after the transpose and refer to the transpose table columns using ' * '. 

Is there a way to format the VAR data?

 

 

 

ROC TRANSPOSE DATA=have OUT=want;
BY type_code;
VAR money_spent;
ID Fiscal_week;
RUN;

 

 

View solution in original post

1 REPLY 1
Reeza
Super User

Add a PREFIX option to your date variables, say FW_ for fiscal week. Then you can shortcut reference them as FW_

Add IDLABEL option so that your labels are still what you want to see. 

 

 

ROC TRANSPOSE DATA=have OUT=want  PREFIX=FW_;
BY type_code;
VAR money_spent;
ID Fiscal_week;
IDLABEL Fiscal_Week;
RUN;

data WANT2;
set WANT;

format FW_: dollar24.;

run;

@yelkenli wrote:

I use Proc Transpose on a data set that results in column headers that are fiscal weeks.  The weeks extend back a year and are updated each week.  I would like to format the data in the new table without listing the new columns explicitly. 

I have several more queries after the transpose and refer to the transpose table columns using ' * '. 

Is there a way to format the VAR data?

 

 

 

ROC TRANSPOSE DATA=have OUT=want;
BY type_code;
VAR money_spent;
ID Fiscal_week;
RUN;

 

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 681 views
  • 1 like
  • 2 in conversation