Operations Research topics: SAS/OR,
SAS Optimization, and SAS Simulation Studio

Transposing vars using array function

Reply
N/A
Posts: 0

Transposing vars using array function

Hi folks!

I´m trying to perform a division using an array.
The information I have are in columns and I wanna change then to line at same divide them.

Example raw file:

Date - Var1 - Var2 - obs
Jan/06 - 200 - 1000 - 1
Jan/06 - 300 - 1000 - 2
Jan/06 - 400 - 1000 - 3
Jan/06 - 500 - 1000 - 4

after process the desirable result (Var1 / Var2) follow as show bellow

jan/06 - 0.2 - 0.3 - 0.4 - 0.5

Thanks Message was edited by: Carlos
Frequent Contributor
Posts: 91

Re: Transposing vars using array function

Try something like:
Data Step2;
set step1;
result = var1/var2;
run;
proc transpose data=step2 out=step3(drop=_Smiley Happy prefix=Result;
by date;
var result;
id obs;
run;
proc print data=step3;
run;
Ask a Question
Discussion stats
  • 1 reply
  • 151 views
  • 0 likes
  • 2 in conversation