Hello, I believe I am in the right path but don't know how to rearrange a variable in my data in ascending order.
The question is :
For each region, how many salesmen are in each state, what are the advertising expenditures for each state (in ascending order), and what is the total advertising expenditure for the region
This is what I have so far:
proc print data=datain .newstate;
sum expenses ;
by region;
options byline;
title ‘The sum of salesman for each region by state’;
run;
I have attached a file of the output.
First, sort you input file by REGION EXPENSES; then run your proc PRINT as is against the result.
What is wrong with this output?
First, sort you input file by REGION EXPENSES; then run your proc PRINT as is against the result.
@hashman wrote:
First, sort you input file by REGION EXPENSES; then run your proc PRINT as is against the result.
Now I'm confused.
The original question asked for each STATE in ascending order.
what are the advertising expenditures for each state (in ascending order)
@PaigeMiller: The sentence can be interpreted as ascending by state or by expenditures. Since the OP's output was already by state within region, while the expenditures within region were disordered, of which s/he seemed to be complaining, ergo ... Perhaps the goal was to use the output to eyeball more readily which states within region had lower expenditures and which ones - higher. Agree that the task could be formulated less murkily.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.