## Declaration of multiple arrays

Solved
Occasional Contributor
Posts: 17

# Declaration of multiple arrays

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*/

/* 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;

Accepted Solutions
Solution
‎01-16-2018 12:17 AM
Super Contributor
Posts: 500

## Re: Declaration of multiple arrays

[ Edited ]

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;``````

All Replies
Solution
‎01-16-2018 12:17 AM
Super Contributor
Posts: 500

## Re: Declaration of multiple arrays

[ Edited ]

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;``````
Occasional Contributor
Posts: 17