BookmarkSubscribeRSS Feed
jdub
Calcite | Level 5

Hi

I have data like the following:

quarterareanaicsagegrphires
200111111604
20011year1112416
200118911155
200118911286
200111511203
200111512143
200118951112
20011895128
200121111300
200121112256
200128911145
200128911267
20012151156
20012151276
200128951112
20012895127
200131111412
200131112365
200138911142
200138911256
200131511532
200131512432
200138951134
200138951212

I am trying to create something like:

yearquarternaicshiresN
20011111161
2001151366
2001211668
2001251151
2001311875
20013511010

where hiresN is the sum of hires in the first data set over counties and age groups

How could I code this?

2 REPLIES 2
art297
Opal | Level 21

You could use:

proc summary data=have nway;

  class year quarter naics;

  var hires;

  output out=want sum=hiresN;

run;

HTH,

Art

dhana
Fluorite | Level 6

If you are familiar with PROC SQL then you can use that also.

PROC SQL;

   SELECT YEAR,QUARTER,NAICS,SUM(HIRES) AS HIRESN

   FROM NEWDS

   GROUP BY YEAR, QUARTER, NAICS;

QUIT;

Thanks

Dhanasekaran R

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 2 replies
  • 684 views
  • 0 likes
  • 3 in conversation