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

Hello,

So, I have to import data from a csv file in pretty good shape to a new SAS table.

In a data step I set up INFORMATs FORMATs and the INPUT statement. The file is imported correctly the only problem is that instead of just missing values (as in ,,) some field have ,null, as a value between separators. That particular variable will be numeric so when on that value I give a numeric INFORMAT (like BEST2. since there are 2 digits numbers where there isn't null) the log shout at me "invalid data".

Take notice that the resulting table is correct, in that particular field I have, as I should, the period.

How can I resolve the warnings?

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
Kurt_Bremser
Super User

You could create a custom format:

proc format library=work;
invalue testfmt
 'null' = .
  other=best.
;
run;

data test;
input x1 testfmt.;
cards;
null
1
2
0
.
;
run;
Crysis85
Obsidian | Level 7

Didn't think of that, thanks!

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
  • 2 replies
  • 3052 views
  • 1 like
  • 2 in conversation