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

Hi.....Is it possible from having to list the variable names in the Column Statement as the number of columns may change depending on the time frame for my dataset. For example, I am creating a report on the Annual Sales and each column represent the Sales for each year. Column names could be 2014, 2015, and 2016 if the dataset has the sales for these 3 years, However, the dataset could contain Sales for more than these 3 years and it is not known until the dataset is summarized. Any suggestions on how to get around this....Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Yes, if you use a naming convention. Then you can use a variable list or the colon notation. For example if you used Year as the prefix in front of your Year variables. 

 

Column Year: ;

 

Another option would be to use a long dataset and treat the variable as an ACROSS variable. 

View solution in original post

2 REPLIES 2
Reeza
Super User

Yes, if you use a naming convention. Then you can use a variable list or the colon notation. For example if you used Year as the prefix in front of your Year variables. 

 

Column Year: ;

 

Another option would be to use a long dataset and treat the variable as an ACROSS variable. 

Cynthia_sas
SAS Super FREQ
Hi:
Also, PROC REPORT will summarize your data, so I'm not entirely sure how you are summarizing that doesn't need variable names in the summary procedure too.

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 1658 views
  • 0 likes
  • 3 in conversation