BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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!
2 REPLIES 2
Patrick
Opal | Level 21
Hi SassyGirl

SAS EG is a client. The SAS code is processed on the server.

Using SAS EG: Are you observing this differences when executing the code on the server "local" (which then would be your PC SAS)?

SAS EG might add some pre- and post- code before sending the code to the server - but I wouldn't know how this could lead to what you describe.

I don't have SAS 9.2 at hand "right now" but I'm very interested if someone else with the same versions than you can replicate this behaviour. If yes: That would be something for Tech Support.

Regards, Patrick
Doc_Duke
Rhodochrosite | Level 12
The "list data" task will not allow you to use the same variable more than once in an EGuide generated PRINT task, so I'm assuming that SassyGirl is using the programming interface to generate the output. If so, then all the work is being done by SAS 9.2 and the only addition that EGuide may make is to append some pre- or post- code.

I don't have EGuide 4.1 installed currently, but I believe that same behavior existed there.

Chris@SAS included the instructions to show the entire log in
http://blogs.sas.com/sasdummy/index.php?/archives/131-Do-me-a-favor-stop-doing-me-favors.html

Doc

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 575 views
  • 0 likes
  • 3 in conversation