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