Hi,
If I have a list of saleprice, but I need to get the mean of it (in ascending order) and categories under One variable FloorAreaCat. How do I write the code in Single Proc means step? (p/s I do not want to use Proc sort step in this case)
Appreciate if can help.
Thanks!
What if under the FloorAreaCat consist of "None", "Equal" or "Type" variables, can we do it?
proc sql;
create table want as
select make, mean(msrp) as avg_msrp format=8.1
from sashelp.cars
group by make /*BY or CLASS variables go here and in the SELECT statement*/
order by calculated avg_msrp ;
quit;
How about the below? Can I sort the Mean in ascending order? I have already found the Mean value of my saleprice, and group it under the FlorrAreaCat but I can't seem to sort the Mean value. Can it be done under the same Proc Means Step?
FloorAreaCat N Obs Mean (SalePrice)
Equal 200 200000
None 800 150000
Small 90 340000
@BabyWS2001 wrote:
How about the below? Can I sort the Mean in ascending order? I have already found the Mean value of my saleprice, and group it under the FlorrAreaCat but I can't seem to sort the Mean value. Can it be done under the same Proc Means Step?
FloorAreaCat N Obs Mean (SalePrice)
Equal 200 200000
None 800 150000
Small 90 34000
That's DESCENDING order......
Any problem that says you can't use PROC SORT to get things properly sorted seems like it's a made up problem.
For your special requirements, entire thing can be done in a data step. No need for Proc Sort, Proc Means.
Do you like a data step?
Provide a small example data set and what the result needs to look like.
Write a data step to provide the example data or Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
Any artificial restriction of "cannot use Proc sort" is similar to "I want to eat canned food without opening the can".
Is ok, cause this is my Uni SAS programing assignment question. Will try to find a way out if there no way to solve this question.
Thanks.
Here the question
(q) list down in ascending order the mean sale price, categories under variable of FloorAreaCat. Use single Proc Means step to answer this question.
A single PROC MEANS doesn't mean you can't use SORT in my opinion. Or maybe there is a way...I would check your class notes.
@BabyWS2001 wrote:
Here the question
(q) list down in ascending order the mean sale price, categories under variable of FloorAreaCat. Use single Proc Means step to answer this question.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.