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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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