Online File

How to use this page


Rick Aster: Professional SAS Programming Secrets: Contents

Chapter 13
Program 13f
Flexcode VAR statement


*
  Professional SAS Programming Secrets
  Program 13f
  Flexcode VAR statement
*;

data _null_;
   length varstatement $ 64;
   set work.dubious end=last;
   if a > 0 then count_a + 1;
   if b > 0 then count_b + 1;
   if c > 0 then count_c + 1;
   if d > 0 then count_d + 1;
   if e > 0 then count_e + 1;
   if f > 0 then count_f + 1;
   if last then do;
      varstatement = 'var';
      if count_a > 0 then varstatement = catx(' ', varstatement, 'a');
      if count_b > 0 then varstatement = catx(' ', varstatement, 'b');
      if count_c > 0 then varstatement = catx(' ', varstatement, 'c');
      if count_d > 0 then varstatement = catx(' ', varstatement, 'd');
      if count_e > 0 then varstatement = catx(' ', varstatement, 'e');
      if count_f > 0 then varstatement = catx(' ', varstatement, 'f');
      varstatement = cats(varstatement, ';');
      call symputx('VARSTATEMENT', varstatement);
      end;
run;
proc print;
   &VARSTATEMENT.
run;

 O /\

Global
Statements

RICK ASTER

SAS

BOOKS

Tech | Dictionary

Download | Rastinate

Rick Aster

Professional SAS Programming Secrets

Contents/Online Files

Corrections