0
votes
data a;
 input accountno name $;
 datalines;
1.01 x
0.999 harshit
1.99 y
2 kumar
3 manali
;
Run;

proc print; run;


proc format;
value h
0-1='g.0-1'
1-3='g.1-3'
;
run;

proc print data = a;
 format accountno h.;
run;


proc summary data = a nway;
 class accountno;
 format accountno h.;
 var accountno;
 output out = hpd;
run;

proc print; run;

in proc summary it will not take var accountno also gives

WARNING: Variable accountno already exists on file WORK.HPD. WARNING: The duplicate variables will not be included in the output data set of the output statement number 1. so what is the solution?

1

1 Answers

0
votes

Not completely sure what you are wanting to get in the output, but I can tell you why you are getting the warning message.

In proc summary, you are using the same variable name in the class statement as you are using in your var statement. In the referent output dataset, the procedure is letting you know that you are duplicating a variable name.

You could add an extra variable in the data step that writes out to data 'a';

If you are trying to just get frequencies of the class variable, remove the var statement completely as in:

    proc summary data = a;
    class accountvar;
    output out = freqs;
    run;