Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 1.54 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Unmatched quotation mark SAS
  2. %macro name_modal();
  3. /*Create macro variables which contain the modalities of variables*/
  4. %do i=1 %to &num_Var;
  5.     data _null_;
  6.         set  &lib..Table_variable_modal_&i.;
  7.         call symputx('num_Mod'||compress(put(&i,4.)),_N_,"G");
  8.         call symputx('table'||compress(put(&i,4.))||'modal'||compress(put(_N_,4.)),compress(&&name_Var&i.),"G");
  9.     run;
  10.  
  11. %end;
  12.  
  13. /*Display modalities by variable*/
  14. %do i=1 %to &num_Var;
  15.     %put &&name_Var&i. has &&num_Mod&i. modalities ;
  16.     %do j=1 %to &&num_Mod&i.;
  17.         %put %nrstr(&&tableb&i.modal&j.);
  18.     %end;
  19. %end;
  20. %mend name_modal;
  21. %name_modal();
  22.        
  23. data test;
  24.  input name ~ &  $15.;
  25.  datalines;
  26.  100% BLO
  27.  100% COLOR
  28.  AVON & RAGOBERT
  29.  BALLANTINE'S
  30.  L'OREAL
  31.  AT&T
  32.  U-V-A
  33.  ;
  34. run;
  35.  
  36. %macro name_modal();
  37. /*Create macro variables which contain the modalities of variables*/
  38. %do i=1 %to 4;
  39.     data _null_;
  40.      set  test;
  41.      call symputx('num_Mod1',_N_,"G");
  42.      call symputx('tableb'||compress(put(&i,4.))||'modal'||compress(put(_N_,4.)),name,"G");
  43.     run;
  44. %end;
  45.  
  46.    %do i=1 %to 4;
  47.     %do j=1 %to 7;
  48.         %put %superq(tableb&i.modal&j);
  49.     %end;
  50.    %end;
  51. %mend name_modal;
  52. %name_modal();
  53.        
  54. %Macro Test(var=);
  55.  %Put &var;
  56. %Mend test;
  57.  
  58. %Test(Var=%str($100% BLO)) ;
  59.  
  60. %Test(Var=%str(100% COLOR)) ;
  61. %Test(Var=%nrstr(100 %COLOR)) ;
  62.  
  63. %Test(Var=%str(AVON & RAGOBERT)) ;
  64. %Test(Var=%nrstr(AVON &RAGOBERT)) ;
  65.  
  66. %Test(Var=%str(BALLANTINE%'S)) ;
  67. %Test(Var=%bquote(BALLANTINE'S)) ;
  68.  
  69. %Test(Var=%str(L%'OREAL)) ;
  70. %Test(Var=%bquote(L'OREAL)) ;
  71.  
  72. %Test(Var=%nrstr(AT&T)) ;
  73. %Test(Var=%str(U-V-A)) ;