Hello -
I'm very new to SAS and need some assistance using proc quantreg. I have a series of yield data from 1950-2015 for each county in a state. I need to use proc quant reg on each county. Should I use an array? Thanks for any input!
Here is a sample of part of the dataset:
Year | Allen | Anderson | Atchison | Barber |
1950 | 25.0 | 24.0 | 18.0 | 11.0 |
1951 | 11.0 | 11.0 | 13.0 | 13.0 |
1952 | 22.0 | 21.0 | 16.0 | 22.0 |
1953 | 25.0 | 26.0 | 23.0 | 11.0 |
1954 | 32.0 | 33.0 | 25.0 | 12.0 |
1955 | 31.0 | 32.0 | 35.0 | 6.0 |
1956 | 33.0 | 35.0 | 32.0 | 13.0 |
1957 | 20.0 | 24.0 | 29.0 | 16.0 |
1958 | 30.0 | 30.0 | 30.0 | 29.0 |
1959 | 26.0 | 27.0 | 25.0 | 20.0 |
1960 | 32.0 | 33.0 | 16.0 | 29.0 |
Transpose your data so it's long rather than wide and then use a BY variable.
Data becomes:
Year County Value
Code becomes:
proc quantreq data=long ...;
BY COUNTY;
Transpose your data so it's long rather than wide and then use a BY variable.
Data becomes:
Year County Value
Code becomes:
proc quantreq data=long ...;
BY COUNTY;
.... And don't forget to sort BY COUNTY YEAR after the transpose step.
Thank you! Is there a way to print the results into a more uniform result? Instead of multiple tables for each county?
Yes, but that's a new question.
Actually, I think there's an article out there somewhere so you can search.
You would use the ODS TABLES to capture the tables you wanted into a data set and then you can view them together.
Ods table parameterestimates=want;
proc reg code....;
run;
proc print data=want;
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 16. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.