BookmarkSubscribeRSS Feed
ambadi007
Quartz | Level 8

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;
4 REPLIES 4
ballardw
Super User

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?

ambadi007
Quartz | Level 8

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) 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;
ballardw
Super User

@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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 977 views
  • 0 likes
  • 3 in conversation