DATA Step, Macro, Functions and more

SAS getting closed when i run this code.

Reply
Super Contributor
Posts: 276

SAS getting closed when i run this code.

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 

Super Contributor
Posts: 543

Re: SAS getting closed when i run this code.

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?

Super Contributor
Posts: 276

Re: SAS getting closed when i run this code.

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.????

Super Contributor
Posts: 543

Re: SAS getting closed when i run this code.

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!

Super Contributor
Posts: 276

Re: SAS getting closed when i run this code.

Which Version are you using..???

Super Contributor
Posts: 543

Re: SAS getting closed when i run this code.

I am using 9.3.

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

Weird.

Super User
Posts: 5,091

Re: SAS getting closed when i run this code.

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.


Super Contributor
Posts: 543

Re: SAS getting closed when i run this code.

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.

Super Contributor
Posts: 276

Re: SAS getting closed when i run this code.

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

Super Contributor
Posts: 543

Re: SAS getting closed when i run this code.

I did, right before you posted.

Super Contributor
Posts: 276

Re: SAS getting closed when i run this code.

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

any way thank you..

Regards..

Sanjeev.K

Ask a Question
Discussion stats
  • 10 replies
  • 393 views
  • 3 likes
  • 3 in conversation