BookmarkSubscribeRSS Feed
POOJA_J
Obsidian | Level 7

data mnthly_sales;
length zip $ 5 cty $ 8 var $ 10;
input zip $ cty $ var $ sales;
label zip="Zip Code" cty="County" var="Variety" sales="Monthly Sales";
datalines;
52423 Scott Merlot 186.00
52423 Scott Merlot 145.00
52423 Scott Chardonnay 178.06
52388 Scott Chardonnay 35.09
52423 Scott Zinfandel 56.09
52388 Scott Zinfandel 58.00
52423 Scott Merlot 45
52200 Adams Merlot 88
52388 Scott Merlot 88
52200 Adams Chardonnay 78
52388 Scott Chardonnay 166
52200 Adams Zinfandel 56
52388 Scott Zinfandel 45.0
52200 Adams Chardonnay 77.01
52200 Adams Merlot 50
52199 Adams Merlot 49
52200 Adams Chardonnay 55
52199 Adams Chardonnay 56
52200 Adams Zinfandel 78
52199 Adams Zinfandel 79
52200 Adams Chardonnay 90
52199 Adams Merlot 34
52199 Adams Chardonnay 119
52199 Adams Zinfandel 200
;
proc print data=mnthly_sales;
title "Raw Data";
run;

 

1. Using Proc Report I want to display variables in order - cty zip var sales.

2. RENAME CTY AS ‘County/Name’ AND SORT THE DATA

3. FORMAT SALES TO DECIMAL PLACES

4. A LINE DIVIDING THE VARIABLES FROM THE OBS.

5. GROUP COUNTRY ZIP VAR 

6. ORDER THE ROWS WITHIN THE GROUP FOR VAR BY DESCENDING

 

Thanks in advance

1 REPLY 1
Kathryn_SAS
SAS Employee

Here is some code to get you started. It is not clear what you are trying to do with #4.

proc report data=mnthly_sales;
column cty zip var sales;
define cty / group 'County/Name';
define zip / group;
define var / group descending;
define sales / sum format=8.2;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1 reply
  • 589 views
  • 1 like
  • 2 in conversation