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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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