Creating additional columns

Reply
New Contributor
Posts: 2

Creating additional columns

I need some help with adding addtional columns to my report. This is a new report that I send someone on a daily basis.

The file is currently set up with the first column being the initial variable and the following columns resulting from transpose procedures.

 

Now on a daily basis the amount of total columns can change depending on the data, but the person I am sending this to needs it at a consistant amount of columns everyday.

 

-For instance my report today shows these as columns - Inventory|Var1|Var2|Var3

-I need the following on a daily basis no matter if the columns are null -  Inventory|Var1|Var2|Var3|Var4|Var5|Var6|Var7|Var8|Var9

 

Any ideas would be greatly appreciated.

Super User
Posts: 5,260

Re: Creating additional columns

Try skip the transpose step, and use proc tabulate instead.
With the preloadfmt option you could have a format decide no of columns in the report.
Data never sleeps
Super User
Posts: 10,526

Re: Creating additional columns

How are you creating the report- Proc Report, Proc Print, Proc Tabulate, something else?

How are you reading the input data?

 

One way would involve having an empty data set with all of the variables, (keep a copy for reuse) append your daily data and then generate your report with columns with missing data.

 

But you need to be sure that your incoming data doesn't EVER change data type from period to period.

Super User
Super User
Posts: 7,413

Re: Creating additional columns

Hi,

 

Sorry, can we start with what software you are using to create this "report".  It sounds to me like you are creating data for a data transfer, i.e. data that will be sent out.  The term "report" is used to define output files used for review.  

If it is indeed a data transfer, then setup a template dataset, which has all the necessarry columns, with the necessary properties - per the data transfer document (which you will have yes) - then append your data to this template before sending, e.g.:

proc sql;
  create table TEMPLATE (INVENTORY char(20),VAR1 num,VAR2 char(20));
quit;

data send_data;
  set template mydata;
run;
New Contributor
Posts: 2

Re: Creating additional columns

Thank you for your reply. I used the term "report" loosely. Yes this would be considered a data transfer, I will try each of these to see what works, but I think this one might work.

Ask a Question
Discussion stats
  • 4 replies
  • 286 views
  • 0 likes
  • 4 in conversation