How to use rename in sas while merging datasets



Respected sir,
I want to merge dataset merge_cust_order with dataset orderlines as you can see in the following attachment

Question…The problem i am facing is that i have three common variables in two datasets with different data types which can be seen below

Thus i used the rename statement but getting following log error kindly help me…



hello @sanchi_singh1,

you need to do:

data orderlines;
set orderlines;
order_date = put(order_date,datetime19.);

And then do the merge.
Hope this helps!!


Hi …
U can try following :

data temp(drop=Order_Date Added_By Added1);
set lib.orderlines(rename=(added=added1));
Added_by=put(Added_By,$20.) ;/* u can instead on $20 give length of the variable in Merge_cust_order dataset*/
/*post this sort and merge temp with Merge_cust_order dataset */
Let me know in case of any issues :slight_smile:

Meenakshi Tripathi


Mam I wrote following code but after running temp dataset it gave following error as seen in the attachment


HI Sanchi,

There is one syntax error in your code(I might have missed too) i.e. semicolon post set statement ;
also make sure that the format that u shared are the original formats.
for character variable to be converted in numeric format we use INPUT and for numeric to char we can use PUT
I hope this will work :slight_smile: and if not u can ask again …


Is this from JIgsaw academy.I am also learning SAS from there ? Could you help me ?