PROC Report Unknown Number of Columns

Reply
Regular Contributor
Posts: 229

PROC Report Unknown Number of Columns

Hi....I am trying to create a report using PROC Report where the dataset has been transposed. The problem is that I don't know how many columns in advance. What I do know is the name of the columns will be numeric and start with 1 and end at some count number. Is there a way to deal with this as the Column Statement requires column names. The only thing I want to do is add column and row totals in the report. Thanks in advance.

Super User
Posts: 11,343

Re: PROC Report Unknown Number of Columns

Transposed in a data step or proc transpose? I would be surprised that proc transpose would generate a variable name starting with the digit 1.

Can your provide an example of what the proc report code would look like for something with 4 of these column variables?

If the resultant variables from the transpose are all named with the same base, default COL, you can use a variable list such as:

column COL: ;

to treat all variables starting with COL as column

Super User
Super User
Posts: 7,970

Re: PROC Report Unknown Number of Columns

Yes, agree with ballardw, provide example.  If you don't need to do anything else with the variables, the you could do:

proc report...;

     columns _all_;

run;

However it becomes more tricky if you need define statements etc.

Ask a Question
Discussion stats
  • 2 replies
  • 205 views
  • 0 likes
  • 3 in conversation