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: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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