Hi I have a tranpose dataset (converting form numners in to variables) with a prefix statement and Now I need to add a new column to the dataset Date_produced after the form_1-till the form_end . NoI will not be able to add the last couln sincI am not sure how may form numbers would come in the data set . Please help me how to tackel this issue .Below the code
proc transpose data = wc_forms_nat out = nat_forms (drop = _name_) prefix = FORM_;
var form_nbr ;
by claim_id Form_Issued_Date ;
run;
Please show what your resulting data set should look like. It is not clear in what way "how may form numbers would come in the data set " would affect adding a single column called "date_Produced". What values should be assigned to that variable when added?
Hi ,
The new date set columns shoule be in the following order
Clm sx date form_1 form_2 to form_n Date_Produced
I tried using retain statement for ordering , later I realised that the form numbers may different (could be more sometimes ) , So how I can add Date_Produced column at the end of this data set ( Date_Produce column has the date of the report created (sysdate)
Without any information on where that variable is coming or anything I would guess at:
data nat_forms;
set nat_forms;
date_produced="01JAN2017"d;
run;
@ambadi007 wrote:
Hi ,
The new date set columns shoule be in the following order
Clm sx date form_1 form_2 to form_n Date_Produced
I tried using retain statement for ordering , later I realised that the form numbers may different (could be more sometimes ) , So how I can add Date_Produced column at the end of this data set ( Date_Produce column has the date of the report created (sysdate)
Concern about the order of columns in a data set should generally be a low priority. A vast majority of what you may do in SAS will no be affected by the order of the data. If you need columns in a specific order for use by another program after exporting data from SAS then use appropriate tools when writing the output to match. SAS is concerned about the variable name for almost everything.
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.
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.