BookmarkSubscribeRSS Feed
TBS1
Fluorite | Level 6

Dear SAS community,

 

since days I am fighting with the following problem, and growing desperate...!

 

Simply, I do just intend to check a CHAR column col1 for whether its value is missing - trivial for numeric values, but - at least for me - the promise it's the same for characters doesn't seem to come true.        

 

After anonymizing the namings, my code is about (which for numeric columns works perfectly well):

= 8< ======================================================================

data  Out_Tab1;

       set Input_Tab1;

       missing_z=missing( col1);

      

       keep missing_z  col1 ;

run;

 

proc summary data= Out_Tab1;

        by  missing_z;

        var col1;

        output out=Out_Tab2   sum=;

run;

= 8< ======================================================================

 

Once trying to do the same on a character column, however (having tried out uncounted imaginable variations), I regularly receive an error message like this:

 

= 8< ======================================================================

...

ERROR: Variable col1 in list does not match type prescribed for this list.

WARNING: The data set Out_Tab2 may be incomplete.  When this step was stopped there were 0 observations and

WARNING: Data set Out_Tab2 was not replaced because this step was stopped.

ERROR: SAS ended due to errors.

ERROR: Errors printed on pages 9,10.

...

= 8< ======================================================================

 

What needs to be done, that I do not see?? And, where to find documentation on this that is neither terse nor cryptic??

 

Thank you so much in advance - I really need your help, Teona

4 REPLIES 4
smantha
Lapis Lazuli | Level 10
If your intention is to get missing value summary in your output then you can use missing option on proc summary. Your col1 is still character variable you cannot use it on the var statement. Your code should be modified as
By col1;
Var missing_colz;
TBS1
Fluorite | Level 6

many thanks for your support.

It works!

 

Best regards

Teona

AhmedAl_Attar
Rhodochrosite | Level 12

Hi,

The Var requires numeric analysis variables. in your case, you are saying COL1 is a Character variable!

VAR Statement  

 

Hope this helps,

Ahmed

TBS1
Fluorite | Level 6

thank you very much for your advice. I really miss understanding.

Thanks for the link!
Best regards

Teona

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 469 views
  • 3 likes
  • 3 in conversation