We help IT Professionals succeed at work.
Get Started

Creating Labels and Frequency list style reports in SAS code

309 Views
Last Modified: 2016-03-31
Hello, I am trying to create labels for a few variables and then create frequency list style reports (not tables).

In the below  SAS code I am attempting to use var6* and var10 variable and apply labels to all frequencies output as applicable.
Note: * = data1, data2, or data3.  

title 'Match Data1, Data2, Data3 Comparison' ;

/* Creating Labels */

data dir1.output2;
  set dir1.output;
  LABEL  if var6data1 = D then 'Duplicate'
         if var6data1 = B then 'Bad Match' 
         if var6data1 = N then 'New Match'
         if var6data2 = D then 'Duplicate'
         if var6data2 = B then 'Bad Match' 
         if var6data2 = N then 'New Match'
         if var6data3 = D then 'Duplicate'
         if var6data3 = B then 'Bad Match' 
         if var6data3 = N then 'New Match';
run;

data dir1.output3;
  set dir1.output2;
  LABEL if var10 = 1 then 'All'
        if var10 = 2 then 'Data1-Data2'
        if var10 = 3 then 'Data1';
run;


/* Frequency of var10 and var6data1 by var6data2 by var6data3 variables in the code below */

proc freq data=dir1.output3;
  tables var10 / missing out=frequency.lis;
    title 'Frequency of Var10';
run;
           
proc freq data=dir1.output3;
  tables var6data1*var6data2*var6data3 / missing out=frequency.lis;
    title 'var6 Comparison';
run;    

Open in new window


Questions:
Is my code correct? Is there a better way of creating  labels for these variables and then creating/outputting frequencies?  How may I assign each label to a correct frequency output?
Since my input datasets contain 100 thousands of records I am looking for the most sufficient way possible.  

Thank you in advance!
Comment
Watch Question
Database Marketing Consultant
Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE