Welcome to the Simplilearn Community

Want to join the rest of our members? Sign up right away!

Sign Up

Data Science with SAS | Mar 03 - 25 | Ashutosh

_20132

Member
Alumni
Hi,

I have created two new variables with the name "newsales" and "ordersize" then i was trying to create a new table
including these variables but in the output these two variables were not included. How to add those two columns in new table?

/* creating a new variable */
data newsales;
retain sales newsales;
set day1code.electronic;
newsales = Sales*1.05;
run;

/* if else condition */
data ordersize;
set day1code.electronic;
if Quantity <=2 then ordersize = "l";
else if Quantity <5 then ordersize = "m";
else ordersize = "h";
run;
/*creating new table with defined column*/
data temp(keep = Quantity Sales newtsales ordersize );
set day1code.electronic;
run;


Thanks,
Puja
 

_20132

Member
Alumni
Hi,

When m using the below code for renaming from "Order_ID" to "ID" it's not working but if the same code m using for
renaming from "aging" to "age" it's working. Please help me out.

/* rename */
data temp (rename= Order_ID =ID );
set day1code.electronic;
run;

Thanks,
Puja
 

Ashutosh_Trainer

Active Member
Alumni
Trainer
Hi,

When m using the below code for renaming from "Order_ID" to "ID" it's not working but if the same code m using for
renaming from "aging" to "age" it's working. Please help me out.

/* rename */
data temp (rename= Order_ID =ID );
set day1code.electronic;
run;

Thanks,
Puja

Please use this code
data temp (rename = 'Order ID'n =ID );
set training.electronic;
run;

Thanks
Ashu
 
Top