BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
LineMoon
Lapis Lazuli | Level 10

@Reeza : I want to use this process for all type of informations :unfamiliar or familiar.

When, I give more than 500  external files -as input- I will get a sas file formats.

 

Tom
Super User Tom
Super User

If you really know nothing about the files then just run PROC IMPORT on the text files.  It will probably do as good of a job as your code could.

 

You should have enough ideas now to program your macro.  Why not take a stab at it?

Tom
Super User Tom
Super User

So once you have the data into a SAS dataset you now runs some algorithms on it to try and determine what type to use.

You can find the max length.  You can count how many missing values.  Even how many distinct values.

You can try using various INFORMATS on it to see if the value is a number or a date or a time.

 

_missing = missing(value);
_numeric = length(value)<=32 and not missing(input(value,??comma32.)) ;
_datetime = not missing(input(value,??anydtdtm.));
_date = not missing(input(value,??anydtdte.));
_time = not missing(input(value,??anydttme.));

Make up your own rules for what type to use for empty fields. Or how to handle fields where 99% is numeric but there are just a few non-numeric values.

LineMoon
Lapis Lazuli | Level 10

@Tom : please, what do mean by "Why not take a stab at it? "

Reeza
Super User

It means try to write your the desired macro. If you need further help, post what you've tried and identify where you're having issues. 

 

 

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
  • 19 replies
  • 2567 views
  • 6 likes
  • 3 in conversation