Hi All,
I took this from one of the sas sample "http://support.sas.com" . I need to read this data to dataset but data not reading properly.
Any help is greatly helpful
data :
data test;
input Subgroup $1-25 Count Percent Mean Low High PCIGroup Group PValue;
zero=0;
PCI_lbl='PCI group';
grp_lbl='group';
pval_lbl='-';
if count ne . then CountPct=put(count, 4.0) || "(" || put(percent, 3.0) || ")";
val=mod(_N_-1, 6);
if val eq 1 or val eq 2 or val eq 3 then ref=subgroup;
datalines;
Overall 2166 100 1.3 0.9 1.5 17.2 15.6 .
Age . . . . . . . 0.05
<= 65 Yr 1534 71 1.5 1.05 1.9 17.0 13.2 .
> 65 Yr 632 29 0.8 0.6 1.25 17.8 21.3 .
Sex . . . . . . . 0.13
Male 1690 78 1.5 1.05 1.9 16.8 13.5 .
Female 476 22 0.8 0.6 1.3 18.3 22.9 .
Race or ethnic group . . . . . . . 0.52
Nonwhite 428 20 1.05 0.6 1.8 18.8 17.8 .
White 1738 80 1.2 0.6 1.6 16.7 15.0 .
From MI to Randomization . . . . . . . 0.81
<= 7 days 963 44 1.2 0.8 1.5 18.9 18.6 .
> 7 days 1203 56 1.15 0.75 1.5 15.9 12.9 .
Infract-related artery . . . . . . . 0.38
LAD 781 36 1.4 0.9 1.9 20.1 16.2 .
Other 1385 64 1.1 0.8 1.4 15.6 15.3 .
Ejection Fraction . . . . . . . 0.48
< 50% 1151 54 1.2 0.8 1.5 22.6 20.4 .
>= 50% 999 46 0.9 0.6 1.4 10.7 11.1 .
Diabetes . . . . . . . 0.41
Yes 446 21 1.4 0.9 2.0 29.3 23.3 .
No 1720 79 1.1 0.8 1.5 14.4 13.5 .
Killip class . . . . . . . 0.39
I 1740 81 1.2 0.8 1.6 15.2 13.1 .
II-IV 413 19 0.95 0.6 1.5 25.3 26.9 .
;
run;
Thanks
Sam
Sam,
Since some values of subgroup contain multiple words, the easiest way to enter the data may be to manually add an extra space between the values of subgroup and count, and modify your input statement accordingly. E.g.:
data test;
informat subgroup $25.;
input Subgroup & Count Percent Mean Low High PCIGroup Group PValue;
zero=0;
PCI_lbl='PCI group';
grp_lbl='group';
pval_lbl='-';
if count ne . then CountPct=put(count, 4.0) || "(" || put(percent, 3.0) || ")";
val=mod(_N_-1, 6);
if val eq 1 or val eq 2 or val eq 3 then ref=subgroup;
datalines;
Overall 2166 100 1.3 0.9 1.5 17.2 15.6 .
Age . . . . . . . 0.05
<= 65 Yr 1534 71 1.5 1.05 1.9 17.0 13.2 .
> 65 Yr 632 29 0.8 0.6 1.25 17.8 21.3 .
Sex . . . . . . . 0.13
Male 1690 78 1.5 1.05 1.9 16.8 13.5 .
Female 476 22 0.8 0.6 1.3 18.3 22.9 .
Race or ethnic group . . . . . . . 0.52
Nonwhite 428 20 1.05 0.6 1.8 18.8 17.8 .
White 1738 80 1.2 0.6 1.6 16.7 15.0 .
From MI to Randomization . . . . . . . 0.81
<= 7 days 963 44 1.2 0.8 1.5 18.9 18.6 .
> 7 days 1203 56 1.15 0.75 1.5 15.9 12.9 .
Infract-related artery . . . . . . . 0.38
LAD 781 36 1.4 0.9 1.9 20.1 16.2 .
Other 1385 64 1.1 0.8 1.4 15.6 15.3 .
Ejection Fraction . . . . . . . 0.48
< 50% 1151 54 1.2 0.8 1.5 22.6 20.4 .
>= 50% 999 46 0.9 0.6 1.4 10.7 11.1 .
Diabetes . . . . . . . 0.41
Yes 446 21 1.4 0.9 2.0 29.3 23.3 .
No 1720 79 1.1 0.8 1.5 14.4 13.5 .
Killip class . . . . . . . 0.39
I 1740 81 1.2 0.8 1.6 15.2 13.1 .
II-IV 413 19 0.95 0.6 1.5 25.3 26.9 .
;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.