troubleshooting Question

Creating Labels and Frequency list style reports in SAS code

Avatar of labradorchik
labradorchikFlag for United States of America asked on
Statistical Analysis System (SAS)ProgrammingDatabasesUnix OSSystem Programming
9 Comments1 Solution317 ViewsLast Modified:
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';

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

/* 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';
proc freq data=dir1.output3;
  tables var6data1*var6data2*var6data3 / missing out=frequency.lis;
    title 'var6 Comparison';

Open in new window

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!
Database Marketing Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 9 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 9 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004