BookmarkSubscribeRSS Feed
SuryaKiran
Meteorite | Level 14

I need to contact my SAS Admins for a fix to this problem.

Thanks,
Suryakiran
SuryaKiran
Meteorite | Level 14

Today my environment was changed from SAS EG 5.1(GRID SAS93) to SAS EG 7.1(GRID SAS94). I tried running the same code in my new environment. Suprisingly it gave the output I'm looking. Even I tried running the same code in different environments.
Code:

proc format ;

value $se 'M'='Male'

'F'='Female';

run;

data ONE;

set sashelp.class;

format sex $se. ;

gender=put(sex,$se.);

run;

 

Results:

SAS EG 5.1 and Grid on SAS 9.3

1.png

 

SAS EG 5.1 and Grid on SAS 9.4

 

2.png

SAS EG 7.1 and Grid on SAS 9.3

3.png

SAS EG 7.1 and Grid on SAS 9.4

 4.png

 

Ohh! This is something interesting to find the reason for this.

Thanks,
Suryakiran
Tom
Super User Tom
Super User

If you are trying to mix using 9.3 and 9.4 on the same sets of files you will have issues with format catalogs. In general SAS dataset will work ok across versions (on similar hardware), but format catalogs are version specific.  So if you create a format catalog using SAS 9.4 and then tried to read it using SAS 9.3 it would not recognize the format catalog and hence not find your user defined format.

 

 

SuryaKiran
Meteorite | Level 14

Hi Tom,

                  I'm sure I didn't mix 9.3 and 9.4. I didn't have 9.4 earlier. I got it today only.

 

Thanks,
Suryakiran
Shmuel
Garnet | Level 18

I would like to make some summary of posts upto now, with some highlights:

 

1) RMTWORK is a remote directory on a server.

 

2) Running code:  libname rmtwork list; printed next notes:
        Libref=   RMTWORK

        Access=   TEMP

        Physical Name= /work/dev_work/SAS_work266802C0002A_p1sasgrid03

 

     That means it is a temporary library and it is canceled at exit of SAS session.

 

3) In your dataset sex is defined as $1 - it is one character only.

     First character of Female if F,   first chracter of MALE is M;

     That might explain why you see one/first character only;


   4) Because RMTWORK is temporary library, you have to recreate the format each time you start a new session.

        Beyond you may need run FMTSEARCH  option, like:

            options fmtsearch=RMTWORK;

       and as FEMALE is 6 characters long, use $SEX6. format.

 

All in all, here is your code to run with slight changes:

 

proc format library=RMTWORK;

value $sex

     'M'='Male'

     'F'='Female'

     ;

Run;

options fmtsearch=(RMTWORK);

 

data RMTWORK.one;

     length gender sex $6;   /* run with and without sex variable in this line */

 set sashelp.class;

     format sex $sex6.

     gender=put(sex,$sex6.);

run;

 

PAY ATTENTION:  SEX. and $SEX. are different formats.

 

In case you still get SEX column displayed one character only you should call SAS technical support.

          

SuryaKiran
Meteorite | Level 14

proc format library=RMTWORK;

value $sex

'M'='Male'

'F'='Female'

;

Run;

options fmtsearch=(RMTWORK);

 

data RMTWORK.one;

length gender sex $6;

set sashelp.class;

format sex $sex6. ;

gender=put(sex,$sex6.);

run;

 

Capture.PNG

 

Thanks,
Suryakiran
Kurt_Bremser
Super User

Since the newer EG works OK, this might very well be a known bug where the fix is either in a hotfix for 5.1 (that you have not had installed by your admins) or was only incorporated in later EG versions.

Just to make sure, you could go browsing through the fixes for 5.1.

SuryaKiran
Meteorite | Level 14

SAS Technical support says :

 

Hi Kiran,

 

You are running in a grid enabled environment which kicks off multiple workspace sessions

so you will need to define formats in the code that is being executed so that

the format will be known in that workspace server execution.

 

Regards,

Bill

 

 

Here I don't understand want he want me to do.

Thanks,
Suryakiran

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 23 replies
  • 5704 views
  • 0 likes
  • 5 in conversation