02-24-2016 07:36 AM
I have macros string1, string2, string3 declared and initialized in code and I want to send the control to a labeled section which will put them in a message box. However, the do loop in the message box is unable to retrieve the value of macro variable by using the statement:-
here is the main part of the code:-
%let string3; %let n; if anyspace(selpath) then do; string1="Path Should Not Contain Blank Spaces";
string2="select another path"; n=1; link errormsg; tmp_lstbtn._cursor(); return; end; errormsg: commandlist=makelist(); do i=1 to n; commandlist=insertc(commandlist,string!!i,i); end; command=messagebox(commandlist,'S','O',"ERROR: Header Generator"); commandlist=dellist(commandlist); return;
Please suggest a method to get the string values iteratively so that it could be inserted int he list.
02-24-2016 07:56 AM
With the exception of the 4 %let commands, this is all data step code. I guess you're confusing data step code with macro code.
string1 ist not equal to &string1 !!!!
02-24-2016 08:10 AM
Can I suggest you post some test data, and what you want the output to look like. You may also want to clarify what software you are using, as this doesn't look like Base SAS, this is a function call:
02-24-2016 09:15 AM
Ah, so your using AF/SCL. Unfortunately I am not able to help here then, I haven't used it in many years. Am surprised its still being used to be honest. You will probably find that there are currently better methods nowadays if you want to do app deverlopment.
02-24-2016 09:21 AM
Could you provide the corresponding piece of log?
I have a feeling that this:
won't work as you expect, as it will try to concatenate the contents of STRING with the contents of I (instead of giving you the contents of string1 or string2 or string3 and so on)
02-24-2016 09:33 AM
Yes, I think you have hit the nail on the head there KurtBremser. The INSERTC command takes this form:
Now what is appears he is trying to do is use the iterator i to indicate if the value should be string1 or string2. As I said its been a long time since I used this, so am fixed on arrays, or macro. However the question I would say is why have string1/2/3 etc. as macro variables in the first place. Why not insert these into a list of thier own:
if anyspace(selpath) then do; stringlist=makelist(); stringlist=insertc(stringlist,"Path Should Not Contain Blank Spaces",1); stringlist=insertc(stringlist,"select another path",2); link errormsg; tmp_lstbtn._cursor(); return; end;
SCL lists are the method for handling lists of values, so use them rather than creating macro variables?