proc means mean data=original noprint; var ht wt; output out=ht_wt;
data dating; infile "c:/datasets/dating.csv" firstobs=13 dlm=',' dsd truncover; input dum1-dum6 length $ satisf $ conflict $ clearexpct $ truth $ accom $; * Need a value to count; x = 1; if dum1 = . then delete; drop dum1-dum6 length; label satisf='Relational Satisfaction' conflict='Amount of Conflict' clearexpct='Partner Makes Expectations Clear' truth='Willingness to Tell Truth' accom='Willingness to Accomodate Partner';Ans: Use proc summary to summarize the variables satisf and conflict:
proc means noprint; class satisf conflict clearexpct truth accom; var x; output out=out; proc print; * You can also use proc freq; proc freq data=dating; table satisf * conflict; proc freq data=dating; table satisf * conflict * length;
* Using Base SAS; data a; input x @@; datalines; 23 51 76 98 ; data b; input x @@; datalines; 11 23 76 98 115 ; data union; merge a b; by x; proc print; data intersect; merge a (in=a) b (in=b); by x; if a and b; proc print; * Using proc sql; proc sql; select x from a union select x from b; select x from a intersect select x from b;
data temps; input day low high @@; datalines; 1 10 22 2 -1 21 3 -12 20 4 19 31 5 -3 29 6 -16 -2 7 -12 3 8 -6 17 9 -4 27 10 27 40 ;Use ods graphics to graph this data. Use this article by Delwiche and Slaughter to help you set sgplot options:
proc sgplot; series x=day y=low / markers markerattrs=(symbol=star color=green size=7mm); series x=day y=high / markers; xaxis type=discrete ; yaxis label='Daily Temperatures' values=(-20 TO 45 BY 5);; title 'Temperatures at Municipal Airport';
data sales; input region $ sales @@; datalines; North 345 East 732 South 643 West 1243 ;Ans:
proc sgplot; vbar region / freq=sales; * or; proc sgplot; vbar region / response=sales barwidth=0.5 stat=mean fillattrs=(color=magenta); yaxis label='Total Sales';