Hello all-
Happy Friday-
I am writing this out to get some general ideas on how to approach the problem.
Suppoded I have two companies-ABC and DEF, and with each a subset of variables-codes
for example
ABC G9
ABC G11
ABC G25
DEF G15
DEF G27
What I want to do is produce a text file for each company.i.e. ABC.text, DEF.text
In each text file, I need to cycle through the codes in such a way that each file would have-
Hello world
Hello G9
Goodbye
Hello world
Hello G11
Goodbye
...
Hello world
Hello G2000
Goodbye
what I am doing is a lot more complicated but I think if I get the gist then I can carry on-
basically I am outputting a dynamic vba script.What I am really doing is outputting a bunch of statements. I can't include real data as it is highly sensitive-
The VBA script actually works as well as the VBS script-now I just need to macro the heck out of it.
What I can do is output individual files for each iteration but I do not want to do that.
%macro pdf(data=, var=, var1=,var2=,var3=); proc sort data=&data(keep=&var &var1 &var2 &var3) out=values nodupkey; by &var; run; data _null_; set values end=last; call symputx('site'||left(_n_),&var); call symputx('sitea'||left(_n_),&var1); call symputx('siteb'||left(_n_),&var2); call symputx('sitec'||left(_n_),&var3); if last then call symputx('count',_n_); run; select(&var); %do i=1 %to &count; put "Attribute VB_Name = ""Module1"" "; put "Sub &&site&i()"; put "ActiveSheet.Range(""&&sitec&i"").Select"; put " ActiveSheet.OLEObjects.Add Filename:=""T:\P_PPR\PPR_Program\QOS\PPR\NCAL_CG_Files\Complaints Details\2015MY\&&sitea&i"", Link _"; put " :=False, DisplayAsIcon:=True, IconFileName:= _ "; put " ""C:\windows\Installer\{AC76BA86-7AD7-FFFF-7B44-AB0000000001}\PDFFile_8.ico"", IconIndex:=0, IconLabel:= _"; put " ""&&siteb&i"" "; put "ActiveSheet.OLEobjects.Height = 60"; put "ActiveSheet.OLEObjects.Width = 50"; put "End Sub"; put fruit; datalines; end ; run; %end; %mend; %pdf(data=MED_ROS,var=MACRONAME,var1=pdf_file,var2=NAMEX,var3=PLACEHOLD);
... View more