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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.