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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.