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

I want to write a SAS/IML debugging module that I can call with an argument that may be numerical, character, or a list or a table.

This module would print varying messages conditional upon the data type, e.g., 'N', 'C', or, let's say, 'L' for a list, and 'T' for a table.

Is there a SAS/IML function that is similar to the DATA STEP vartype() function that I can use to return the data type of an argument to a module?

The "call struct()" module gives me good information. Is there some way to utilize this module as a function so that I may conditionally execute code based on the contents of a data structure?

1 ACCEPTED SOLUTION

Accepted Solutions
IanWakeling
Barite | Level 11

In IML the function is called TYPE() and works exactly how you are expecting, for example:

   x = 4;
   if type(x)='N' then do;
     /* x is numeric so OK to do stuff... */ 
     x = x # 3;
	 print x;
   end;

View solution in original post

2 REPLIES 2
IanWakeling
Barite | Level 11

In IML the function is called TYPE() and works exactly how you are expecting, for example:

   x = 4;
   if type(x)='N' then do;
     /* x is numeric so OK to do stuff... */ 
     x = x # 3;
	 print x;
   end;
rbettinger
Pyrite | Level 9
Thank you very much, Ian.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 2 replies
  • 789 views
  • 4 likes
  • 2 in conversation