i can do this using proc sql but my variables are 100 so it will take lot of time .Is their any other way so that i haven't to wright 100 variable in select statement
data a;
input s1 s2 s3 s4;
datalines;
1 2 3 4
2 2 4 5
9 9 9 9
;
run;
output
s1 s2 s3 s4
12 13 16 18
This is where the various analysis and reporting PROCs in SAS excel. In your case, it would be PROC SUMMARY:
data a;
input s1 s2 s3 s4;
datalines;
1 2 3 4
2 2 4 5
9 9 9 9
run;
proc summary data=a ;
var s1-s4;
output out=want (drop=_type_ _freq_) sum=;
run;
Assuming your variables are named s1 to s100 something like this should work:
proc summary data = a sum;
var s1 - s100;
output out = a_sum
sum = ;
run;
What do you need exactly as result? A dataset with the sums? Html-Output? The sums appended to the dataset you have?
Using proc summary is highly recommended, but if you can use IML, this maybe a good point to start, because it is designed to work with matrices.
proc iml;
use work.a;
read all var _num_ into have;
close work.a;
want = have[+,];
print want;
quit;
Transpose!
There are just a few scnarios when a wide table make s sense.
A long table structure is easier to query, optimizes storage etc.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.