BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ivethguzman
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
hashman
Ammonite | Level 13

@ivethguzman:

First, sort you input file by REGION EXPENSES; then run your proc PRINT as is against the result.  

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

What is wrong with this output?

--
Paige Miller
hashman
Ammonite | Level 13

@ivethguzman:

First, sort you input file by REGION EXPENSES; then run your proc PRINT as is against the result.  

PaigeMiller
Diamond | Level 26

@hashman wrote:

@ivethguzman:

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)

--
Paige Miller
hashman
Ammonite | Level 13

@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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1053 views
  • 1 like
  • 3 in conversation