I have the following code:
Proc report data=year2_dpinsur;
Title "Insurance Status";
Column dpinsur YY4_DOB,Row_Percent YY4_DOB,Lower_CL YY4_DOB,Upper_CL dummyvar;
Define dpinsur / group;
Define yy4_DOB / across;
Define Row_Percent / display;
Define Lower_CL / display;
Define Upper_CL / display;
define dummyvar / computed noprint;
compute dummyvar;
dummyvar = 1;
endcomp;
Run;
It produces this table:
Insurance Status |
Year | Year | Year | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2016 | 2017 | 2018 | 2019 | 2020 | 2016 | 2017 | 2018 | 2019 | 2020 | 2016 | 2017 | 2018 | 2019 | 2020 | |
Prenatal Insurance Status | Row Percent | Row Percent | Row Percent | Row Percent | Row Percent | 95% Lower Confidence Limit, Row Pct | 95% Lower Confidence Limit, Row Pct | 95% Lower Confidence Limit, Row Pct | 95% Lower Confidence Limit, Row Pct | 95% Lower Confidence Limit, Row Pct | 95% Upper Confidence Limit, Row Pct | 95% Upper Confidence Limit, Row Pct | 95% Upper Confidence Limit, Row Pct | 95% Upper Confidence Limit, Row Pct | 95% Upper Confidence Limit, Row Pct |
Medicaid | 39.83 | 38.41 | 34.13 | 45.03 | 37.50 | 34.87 | 33.74 | 29.52 | 38.98 | 31.63 | 44.80 | 43.08 | 38.73 | 51.07 | 43.36 |
None | 1.79 | 1.89 | 0.29 | 1.42 | 0.60 | 0.22 | 0.46 | 0.00 | 0.00 | 0.00 | 3.37 | 3.31 | 0.68 | 2.92 | 1.37 |
Private | 58.37 | 59.71 | 65.58 | 53.56 | 61.90 | 53.37 | 55.00 | 60.97 | 47.50 | 56.02 | 63.38 | 64.41 | 70.19 | 59.61 | 67.78 |
When what I really want is this layout below, where Row%, lower CL, and upper CL all follow each other under each corresponding year. But I can't figure out how to get that. When I tried YY4_DOB,Row, lower_CL, Upper_CL, it gave the error:
ERROR: There is more than one ANALYSIS usage associated with
the column defined by the following elements.
Year | |||
---|---|---|---|
2016 | |||
Prenatal Insurance Status | Row Percent | 95% Lower Confidence Limit, Row Pct | 95% Upper Confidence Limit, Row Pct |
Column dpinsur YY4_DOB,(Row_Percent Lower_CL Upper_CL) dummyvar;
or as I would prefer to see it
Column dpinsur YY4_DOB,(Lower_CL Row_Percent Upper_CL) dummyvar;
I think you also need
Define Row_Percent / sum;
Define Lower_CL / sum;
Define Upper_CL / sum;
Column dpinsur YY4_DOB,(Row_Percent Lower_CL Upper_CL) dummyvar;
or as I would prefer to see it
Column dpinsur YY4_DOB,(Lower_CL Row_Percent Upper_CL) dummyvar;
I think you also need
Define Row_Percent / sum;
Define Lower_CL / sum;
Define Upper_CL / sum;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.