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;
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;
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.