BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
1 REPLY 1
advoss
Quartz | Level 8
Try something like:
Data Step2;
set step1;
result = var1/var2;
run;
proc transpose data=step2 out=step3(drop=_:) prefix=Result;
by date;
var result;
id obs;
run;
proc print data=step3;
run;

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!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 663 views
  • 0 likes
  • 2 in conversation