Another approach is to use the FORMAT procedure.
The code may look something like this:
PROC FORMAT;
VALUE $SC
'AK','AL','AZ','CA','CO','CT','DC','DE',
'FL','GA','HI','IA','ID','IL','IN','KS','KY','LA',
'MA','MD','ME','MI','MN','MO','MS','MT',
'NC','ND','NE','NH','NJ','NM','NV','NY',
'OH','OK','OR','PA','RI','SC','SD','TN',
'TX','UT','VA','VT','WA','WI','WV','WY' = 'USA'
other= 'NON-US';
run;
Then your code could read
IF PUT(STATE,$SC.) = "USA" then do;
/* put US-based code here */
end;
else do;
/* put foreign code here */
end;
Just to double check - if you want to handle GUam, Puerto Rico, and the US Virgin Islands as US, just add it to the format.