BookmarkSubscribeRSS Feed
kuridisanjeev
Quartz | Level 8

Hi All..

SAS getting automatically closed when i run this bellow code..

Is this a bug???Any IDEA???

Proc Format;

value xyz

        1="Yes"

         2="NO";

run;

Now i supposed to add one more value to this format for the value 3.

i am writing code like this..

Proc Format;

value xyz

        3="Don't know"

         other=[xyz.];

run;

Actually in above code i have to specify new format name,but i forgot and i did't get any error too.

 

Now i am applying this format to a dataset;

data a;

input x;

format x xyz.;

cards;

1

2

3

;

run;

i really wondered after running above code ,because SAS getting Closed automatically.i tried this for  couple of times but same result.

Why this is happening???

Any Idea about this????

Thanks &Regards..

Sanjeev.K 

10 REPLIES 10
AncaTilea
Pyrite | Level 9

I ran the code below (your code, with a very small modification -- in bold) and in worked.

Proc Format;

value xyz

        1="Yes"

         2="No"

         ;

quit;

proc format;

value abc    3="Don't know"

                    other = [xyz.]

        ;

quit;

data a;

input x;

format x abc.;

cards;

1

2

3

;

run;

Can you give more details about what SAS version you are using?

kuridisanjeev
Quartz | Level 8

Hi..

Thanks For your response..

Am using SAS 9.2 version now

and coming to your code modification,

i mentioned in my post as "Actually in above code i have to specify new format name,but i forgot and i did't get any error too".

so I too changed format name and it worked perfectly.

But my question is why SAS getting closed when i run previous code.????

AncaTilea
Pyrite | Level 9

When I ran your original code it did not close SAS.

Not sure what may have been the issue.

Glad it's working now; but it would be good to know what caused SAS to behave this way.

Best of luck!

kuridisanjeev
Quartz | Level 8

Which Version are you using..???

AncaTilea
Pyrite | Level 9

I am using 9.3.

But my coworker just ran it on 9.2 and it closed.

Weird.

Astounding
PROC Star

The original program had a recursive format definition ... to look up a value in the XYZ format, look for "3" and if it's not there then look in the XYZ format.  That this situation closed SAS looks like a bug that was fixed in 9.3.  I would expect that 9.3 gives you some sort of related message when you try the original code.


AncaTilea
Pyrite | Level 9

You are correct, Astounding.

This is the error from SAS(9.3):

ERROR: XYZ is given as a format-as-label within the format of the same name. This would cause

       recursion and is not allowed.

kuridisanjeev
Quartz | Level 8

Hi  ...

Did you get any error message in the log when you ran the original code in SAS 9.3 version??

If yes,Could you please post the log message...

Thanks

Sanjeev.K

AncaTilea
Pyrite | Level 9

I did, right before you posted.

kuridisanjeev
Quartz | Level 8

my browser did't get refreshed...:-)

any way thank you..

Regards..

Sanjeev.K

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 10 replies
  • 1641 views
  • 3 likes
  • 3 in conversation