Re: Use var from have in do loop

Yes, you will need the code from the wizard, so you can plug it into a program. If you are looking to get a separate plot for each combination of values that VEHNO and FAULTNO take on, it sounds like you need this:

proc sort data=have;

by VehNo FaultNo;

run;

proc plot /* or sgplot or whatever the wizard tells you to use */ data=have;

Re: Use var from have in do loop

There are bright red DANGER signs throughout your post that indicate you should not be doing this.

You need to understand SAS language for macro language to be useful. Macro language does not process your data. It builds a program by generating working SAS statements. You are not ready for this yet. Here are just a few examples.

Your message indicates that you think you are using data from the data set HAVE. You're not. There is nothing about your program that reads from an existing SAS data set.

You use the DIM function to refer to an array named Var_in_have. There is no such array. If you did have such an array, it would seem that it should contain names of variables. The reference to "ne ." would be incorrect for referring to a missing value for the name of a variable.

Your intent seems to be to run a macro for every variable. While that's possible, it's extremely unlikely that the same macro would be useful for both character and numeric variables.

You would do better to describe your original data and what you are trying to accomplish. You could get answers here, possibly very simple answers. The answers may or may not include macro language (depending on the goal).

Re: Use var from have in do loop

Yes, you will need the code from the wizard, so you can plug it into a program. If you are looking to get a separate plot for each combination of values that VEHNO and FAULTNO take on, it sounds like you need this:

proc sort data=have;

by VehNo FaultNo;

run;

proc plot /* or sgplot or whatever the wizard tells you to use */ data=have;

Re: Use var from have in do loop

You may want to look into a completely different approach the Graph Templat Language let's you do some pretty interesting things and I think it is much more straight forward then what it looks like you are attempting