BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kmardinian
Quartz | Level 8

I am not sure why I continue to get this error, as I have checked each dataset from Histo1 to Histo18 and ACR is numeric in all the datasets. Any help is much appreciated, thank you!

 

1461  Data Histo;
1462      length CR ID $12;
1463      Set HISTO1-HISTO18;
ERROR: Variable ACR has been defined as both character and numeric.
1464      CR = strip(CAT("CR",strip(put(ACR,best.))));
1465      Drop ACR;
1466  Run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.HISTO may be incomplete.  When this step was stopped there were 0
         observations and 6 variables.
WARNING: Data set WORK.HISTO was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.03 seconds

1 ACCEPTED SOLUTION

Accepted Solutions
SuryaKiran
Meteorite | Level 14

Alternatively you can also query dictionary.columns and find if all of them are numeric.

 

proc sql;
select distinct name,type
from dictionary.columns
where libname="WORK" and memname like 'HISTO%';
quit;
Thanks,
Suryakiran

View solution in original post

4 REPLIES 4
Astounding
PROC Star

You can't just inspect the values to determine whether a variable is character or numeric.  You need to run a PROC CONTENTS on each data set, and inspect the output.

 

SAS will be correct.  You will have a mix where sometimes the variable is character and sometimes it is numeric.

SuryaKiran
Meteorite | Level 14

Alternatively you can also query dictionary.columns and find if all of them are numeric.

 

proc sql;
select distinct name,type
from dictionary.columns
where libname="WORK" and memname like 'HISTO%';
quit;
Thanks,
Suryakiran
kmardinian
Quartz | Level 8

Thank you, that helped a lot. I was able to find the one dataset that had it as a character. Thank you!

ballardw
Super User

You will have this crop up moderately frequently if you are relying on Proc Import to read data sets into SAS.

 

Another frequent issue with Proc Import for multiple sets is the warning similar to:

WARNING: Multiple lengths were specified for the variable x by input data set(s). 
This can cause truncation of data.

because each run of Proc Import guesses separately as to the appropriate length of variables and variable types.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 916 views
  • 0 likes
  • 4 in conversation