BookmarkSubscribeRSS Feed
ebonyw
Calcite | Level 5

Hello - I am extremely green with SAS, so I apologize in advance if this question is overly simple. I've gone through 5 books and can't seem to find what I need.

I have a dataset of medical providers that have submitted data. There are over 9000 lines of data that only a few providers submitted...and I just need simple summary data. See an example below:

Provider ID     Facility Type     Storage Unit Type     Out of Temperature Range? (0=No 1=Yes)     Start Date/Time

011234          Health Dept          Freezer                       0                                                                   1/18/2014  10:36

011234          Health Dept          Freezer                       1                                                                   2/14/2014  15:21

011234          Health Dept          Fridge                         1                                                                   2/28/2014   1:51

059222          Private                  Fridge                         1                                                                   1/5/2014    3:15

059222          Private                  Fridge                         0                                                                   1/12/2014   22:30

352988          Health Dept          Freezer                       1                                                                    3/2/2014   8:34

352988          Health Dept          Freezer                       0                                                                    3/4/2014   9:54

470154          Private                  Freezer                       0                                                                    4/1/2014  11:28

470154          Private                  Fridge                         1                                                                    5/20/2014  10:18

I can't figure out the programming that will give me summary data that tells me there were 4 providers - 2 health departments and 2 private medical facilities...and that this data came from 3 freezers and 3 refrigerators. Thanks so much!

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Well there is proc summary: Base SAS(R) 9.2 Procedures Guide

Personally I don't use it so can't give an example.  I tend to use other methods - proc means, SQL.  So depends how you want your output to look, one way is:

data have;

  infile datalines dlm=",";

  input provider $ facility $ storage $;

datalines;

0011234,Health Dept,Freezer

0011234,Health Dept,Fridge

059222,Private,Fridge

;

run;

proc sql;

  create table WANT as

  select  "Provider",

          count(distinct PROVIDER) AS CNT

  from    HAVE

  union all

  select  "Facility",

          count(distinct FACILITY) AS CNT

  from    HAVE

  union all

  select  "Storage",

          count(distinct STORAGE) AS CNT

  from    HAVE;

quit;

ebonyw
Calcite | Level 5

Thank you, RW9! I will try this. I really appreciate your response. Smiley Happy

RW9
Diamond | Level 26 RW9
Diamond | Level 26

No probs.  As I say though, check out the procedures that are available as well, most will be easier to work with if they do what you want.  I tend to be using the counts and such like in other things and as part of a bigger SQL statement, so running a proc then going back to the SQL is a pain.

StatDave
SAS Super FREQ

Just a simple application of PROC FREQ:

proc freq;

tables provider facility storage;

run;

or, if you just need the number of levels in each variable and not the counts of observations in each level:

proc freq nlevels;

tables provider facility storage / noprint;

run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1460 views
  • 0 likes
  • 3 in conversation