BookmarkSubscribeRSS Feed
amarikow57
Obsidian | Level 7

My code:

%let IN = inCKD.DET20;

DATA OUT.IN_FILTER_07A;
	SET &IN.07A;
	FORMAT CLM_FROM CLM_THRU yymmdd10.;
	keep FIVEP_ID CLM_FROM CLM_THRU HCPCS;
RUN;

DATA OUT.IN_FILTER_07A;
	SET &IN.07A;
	if '90935' <= HCPCS <= '90999' then DIA = 1;
	else DIA = 0;
RUN;

My log:

 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         /* Create Treatment Variables */
 74         %let IN = inCKD.DET20;
 75         
 76         DATA OUT.IN_FILTER_07A;
 77         SET &IN.07A;
 NOTE: Data file INCKD.DET2007A.DATA is in a format that is native to another host, or the file encoding does not match the session 
       encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce 
       performance.
 78         FORMAT CLM_FROM CLM_THRU yymmdd10.;
 79         keep FIVEP_ID CLM_FROM CLM_THRU HCPCS;
 80         RUN;
 
 NOTE: Format $CDTYPEI was not found or could not be loaded.
 NOTE: Format $HCFASAF was not found or could not be loaded.
 NOTE: There were 10200000 observations read from the data set INCKD.DET2007A.
 NOTE: The data set OUT.IN_FILTER_07A has 10200000 observations and 4 variables.
 NOTE: DATA statement used (Total process time):
       real time           47.44 seconds
       cpu time            42.04 seconds
       
 
 81         
 82         DATA OUT.IN_FILTER_07A;
 83         SET &IN.07A;
 NOTE: Data file INCKD.DET2007A.DATA is in a format that is native to another host, or the file encoding does not match the session 
       encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce 
       performance.
 84         if '90935' <= HCPCS <= '90999' then DIA = 1;
 85         else DIA = 0;
 86         RUN;
 
 NOTE: Format $CDTYPEI was not found or could not be loaded.
 NOTE: Format $HCFASAF was not found or could not be loaded.
 NOTE: There were 10200000 observations read from the data set INCKD.DET2007A.
 NOTE: The data set OUT.IN_FILTER_07A has 10200000 observations and 12 variables.
 NOTE: DATA statement used (Total process time):
       real time           49.54 seconds
       cpu time            43.61 seconds
       
 
 87         
 88         
 89         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 101        

 
User: sasdemo
DATA Step Statements

The code is simple enough. I made a macros out of it (not shown) and while it works for some documents just fine. There are select ones that do not transfer over any of the data from FIVEP_ID and HCPCS, as in they're just blank cells. The documents hold all the same data, so in theory code that works for one should be able to work for the rest but it isn't. Why is this happening and how can I fix it?

 

Thank you in advance.

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Why do you create a table and then overwrite it?

Astounding
PROC Star

It sounds like the structure of your data is slightly different from run to run.

 

One (or more) variable is supposed to use the CDTYPEI format.  As long as that variable is numeric, the program works fine.  But sometimes that variable is character, causing SAS to look for the $CDTYPEI format (which does not exist).

 

Similarly, one (or more) variable is supposed to use the HCFASAF format.  As long as that variable is numeric, the program works fine.  But sometimes that variable is character, causing SAS to look for the $HCFASAF format (which does not exist).

 

If you fix the data and make those variables numeric, the program should work.  However, that may not be a simple task.  The variables may be character because they occasionally contain characters such as "N/A".  It's not clear what the proper fix would be to make the variable numeric.  So there are decisions to make.  But the task remains the same.  Fix the data.

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
  • 478 views
  • 0 likes
  • 3 in conversation