I had a difference using PC SAS 9.2 and EG SAS 4.2 that came up the other day with my co-workers. We often have to repeat a variable name while using the Proc Print statement. We found these differences and were wondering if you guys/girls had picked-up this repeating variable before today.
Program in PC SAS 9.2
data one;
input x1 x12 x3 x4;
datalines;
1 2 3 4
5 6 7 8
9 10 11 12
;
proc print uniform;
var x1 x12 x1 x3 x4 x3;
run;
___________
Output in PC SAS 9.2
Obs x1 x12 x1 x3 x4 x3
1 1 2 1 3 4 3
2 5 6 5 7 8 7
3 9 10 9 11 12 11
Program and text using SAS EG 4.2:
After checking all boxes of the result formats (SAS report, HTML, PDF, RTF and Text output) on Results General Panel, I then ran the SAS program in SAS EG 4.2. Here are the results for all result formats:
1. SAS Report- rename variable if a variable is listed more than once in PROC PRINT statement. So, we have variables x1, x12, x122, x3, x4, x32. Notice variable x122 is printing variable x1 but it could not label it x12 because that variable exists.
2. HTML-Printed the variables as SAS 9.2.
3. PDF –Printed the variables as SAS 9.2.
4. RTF –Printed the variables as SAS 9.2.
5. Text output- dropped the variable if a variable is listed more than once in PROC PRINT statement. So for Text output the variables are X1, x12, x3, x4.
As you can see, I got the same output for HTML format, PDF format and RTF format. However, SAS report does rename variable if a variable is listed more than once in PROC PRINT statement. On the other hand, Text Report drops the additional variable if a variable is listed more than once in PROC PRINT statement.
I do not know the reason why SAS report format and Text Report format print differently. I think there is a reason for that.
Maybe, you will take this program and try running it in SAS 9.2 and EG 4.2!
Have a good weekend!