BookmarkSubscribeRSS Feed
CathyVI
Pyrite | Level 9

The following table is an animal data and I am trying to find the number of encounter that have animal data by setting.

Someone recommend using pro sql but am a novice to sql so is there any other method?

 fake data;

Income Setting Name Code  Encounter_no

   100     ABC          Cat      123      98765

   200      BAC         Dog    321       78675

   300      CDA         Bird      121       34555

 

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Just to be clear, you want to sum the Encounter_No by Setting? Otherwise, please be more specific 🙂

CathyVI
Pyrite | Level 9

Yes the question is below;

 

  • Find Number of encounters that have any animal data by:
    • Setting
    • Income
PeterClemmensen
Tourmaline | Level 20

If I understand your question correctly

 

data have;
input Income Setting $ Name $ Code Encounter_no;
datalines;
100 ABC Cat 123 98765
200 BAC Dog 321 78675
300 CDA Bird 121 34555
;

proc summary data=have nway;
   class Setting Income;
   var Encounter_no;
   output out=want(drop=_TYPE_ _FREQ_) sum=sum;
run;
Reeza
Super User

PROC FREQ and PROC MEANS are the most used procs in SAS. Learn them well 🙂

 

proc freq data=have; *Have is your input data set name;
table setting;
table income;
run;

@CathyVI wrote:

The following table is an animal data and I am trying to find the number of encounter that have animal data by setting.

Someone recommend using pro sql but am a novice to sql so is there any other method?

 fake data;

Income Setting Name Code  Encounter_no

   100     ABC          Cat      123      98765

   200      BAC         Dog    321       78675

   300      CDA         Bird      121       34555

 


 

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
  • 670 views
  • 0 likes
  • 3 in conversation