data k;
input name $ sales95 - sales99;
cards;
vandana 876 48 4 562 23
nandu 23 8763 36 3 234
roy 23 3 7863 3 32
john 23 5 7653 3 323
daniel 432 8654 4 234 234
run;
/*1 USD = 67.94 INR*/
/*please help me find the solution for the below question*/
/* keep both dollars and rupees with in a single dataset*/
/*data in the cards are in USD*/
/*i converted usd to inr using below code and it worked*/
/*how to keep both dollars and rupees with in a single dataset*/
data k;
input name $ sales95 - sales99;
array vishnu(5) sales95-sales99;
do lilly=1 to 5;
vishnu(lilly)= vishnu(lilly)*67.94;
end;
drop lilly;
cards;
vandana 876 48 4 562 23
nandu 23 8763 36 3 234
roy 23 3 7863 3 32
john 23 5 7653 3 323
daniel 432 8654 4 234 234
run;
Please post code using {i} or running-man-icon.
You will have to create new variables to hold the converted values.
data k;
length Name $ 20 Sales95-Sales99 Rupies95-Rupies99 8;
input name $ sales95 - sales99;
array vishnu(5) sales95-sales99;
array rupies(5) Rupies95-Rupies99;
do lilly=1 to 5;
rupies(lilly) = vishnu(lilly) * 67.94;
end;
drop lilly;
cards;
vandana 876 48 4 562 23
nandu 23 8763 36 3 234
roy 23 3 7863 3 32
john 23 5 7653 3 323
daniel 432 8654 4 234 234
;
run;
Please post code using {i} or running-man-icon.
You will have to create new variables to hold the converted values.
data k;
length Name $ 20 Sales95-Sales99 Rupies95-Rupies99 8;
input name $ sales95 - sales99;
array vishnu(5) sales95-sales99;
array rupies(5) Rupies95-Rupies99;
do lilly=1 to 5;
rupies(lilly) = vishnu(lilly) * 67.94;
end;
drop lilly;
cards;
vandana 876 48 4 562 23
nandu 23 8763 36 3 234
roy 23 3 7863 3 32
john 23 5 7653 3 323
daniel 432 8654 4 234 234
;
run;
Thank you andreas_Ids. Got it.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.