Friday, 15 August 2014

SAS macro do-loop with data step -


This is my first macro, so please forgive me if I miss something simple.

The same data phase I need to do is add six (or more) times and before each, so I tried do-loop within the macro, everything worked with the loop being removed. But after adding a do-loop, I get errors, either I would say that I have an extra% end or an external% interaction. Thank you all the ideas welcome! % Macro freeze_sample (Genesis_file =, sample =, start_freeze_increar =, end_freeze_incra =); % Do I = 1% from & amp; Samples; Data freeze_slus_ & amp; I; Set & amp; Orig_file; (Work); * If we have more than one piece, add the last slice (s) ;; % I & amp; I & gt; % 1%; Proc attachment = temp_1 data = temp_ & amp; I; Run; %End; %End; % improvement;

I think you have either a problem that you did not include in the lesson (I.e., in the 'Do Stuff' section) or you have a bad session (i.e., you have fixed the problem but from the last run there is something that is now messing up). It runs fine (I do not know what you are doing):

 % Macro freeze_smulation (original_file =, sample =, Start_Freeze_Incr =, End_Freeze_Incr =); % Do I = 1% from & amp; Samples; Data freeze_slus_ & amp; I; Set & amp; Orig_file; *(to work); Run; * If we have more than one piece, then add the last slice (s) ;; % I & amp; I & gt; % 1%; Attach attach bas = freeze_slice_1 data = freeze_slus_ & amp; I; Run; %End; %End; % improvement; % Freeze_samples (orig_file = sashelp.class, samples = 2, start_freeze_incr = 1, end_freeze_incr = 5);   

I will keep in mind that you are probably not better for what you are doing; In SAS, turning off data in different datasets is usually a better method but since I do not know what you are doing I can not really suggest a better way to read and meditate (Even if you're doing something different from bootstrapping, this concept applies to almost all things in SAS).

No comments:

Post a Comment