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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1121 views
  • 0 likes
  • 3 in conversation