BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
VISHNU239
Obsidian | Level 7

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;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

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;

View solution in original post

2 REPLIES 2
andreas_lds
Jade | Level 19

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;
VISHNU239
Obsidian | Level 7

Thank you andreas_Ids. Got it.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 1586 views
  • 1 like
  • 2 in conversation