BookmarkSubscribeRSS Feed
mikeydubs23
Calcite | Level 5

I have a large dataset with dates as columns.  Actually the columns are a simulated date (_YYYYMMDD_) stored in a macro variable, but that's a whole other issue.  I then print this data by an ID with those dynamic dates.  However, some of the data may have data on Monday, Wednesday and Friday whereas other data may have just Monday and Wednesday.  Since the macro variable contains all valid days stored for the complete set of data, the IDs that only have Monday and Wednesday will always have that blank column for Friday.  I want to only have non-blank columns print on each by group.  Is this possible without completely re-writing the way I store the data.

ID  _20161102_  _20161104_  _20161107_  _20161109_  _20161111_

1           12                 22                  33                    12               33

2             7                   .                   22                     11                .

 

When 1 is printed I want it to have all columns, but 2 should only show the days/columnswhen there is data. 

 

 

2 REPLIES 2
Reeza
Super User

You would be better off storing the data in a long format and then reporting using a proc report and Across or proc tabulate.

 

Let's assume that's not possible for some reason.

 

Based on your variable list you can compute statistics, and if the NMISS is equal to the total number of observations then you can select those column names for your final report. 

 

There's no simple filter in proc print that I'm aware of.

 

 

Astounding
PROC Star

It's work, but you can do it by using customized reporting (a DATA step with FILE an PUT statements to generate the report).  Your DATA step skills will need to be good (including familiarity with arrays plus a firm grasp of what you want the report to look like) to make this happen.

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
  • 991 views
  • 0 likes
  • 3 in conversation