<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Call execute to label variables getting statement not valid error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-to-label-variables-getting-statement-not-valid/m-p/948805#M371192</link>
    <description>&lt;P&gt;CALL EXECUTE works after the data step it is in finishes. So ... LABEL statement outside of a DATA step or PROC is not allowed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't use CALL EXECUTE here, just include the LABEL statement in the DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I point out that looping through variables one variable at a time in a macro is an extremely inefficient way of doing most things. Better to figure out how to handle all variables in one pass. Storing means and standard deviations in a macro variable is unnecessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;EVEN BETTER APPROACH&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;SAS has an extremely wide ranging set of PROCs to perform statistical and other analyses, you should try to find a PROC that does what you want before resorting to macros. I see you performing a standard statistical calculation like this (which is called standardizing):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;amp;var._z = ((&amp;amp;var.-&amp;amp;var._m)/&amp;amp;var._s); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Surely there is a PROC that will standardize your variables! In fact there is a PROC, it is called PROC STDIZE. The entire macro and all the looping is unnecessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So except for your label statement, none of this looping or macro is necessary, and this ought to get you what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdize data=jobquality_2 method=std out=jobquality_2z oprefix=o_ sprefix=z_;
     var c1-c31; /* or whatever the variable names are */
run;
     &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so your standardized values and original values are now in data set jobquality_2z&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2024 21:36:08 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-10-23T21:36:08Z</dc:date>
    <item>
      <title>Call execute to label variables getting statement not valid error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-to-label-variables-getting-statement-not-valid/m-p/948803#M371191</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to systematically label newly created variables using the label of an old variable. When I use the call execute command, I am getting an error saying "Statement is not valid or it is used out proper order."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this &lt;A href="https://support.sas.com/resources/papers/proceedings10/047-2010.pdf" target="_self"&gt;source&lt;/A&gt; as reference.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro zscore(var=,); 

proc means data = jobquality_2 noprint; 
	var &amp;amp;var.; 
	output out = &amp;amp;var._stat; 
run;  

*create macro var of var mean &amp;amp; std; 
data _null_; 
	set &amp;amp;var._stat; 
	if _STAT_ = "MEAN" then call symputx('mean',&amp;amp;var.); 
	if _STAT_ = "STD" then call symputx('std',&amp;amp;var.); 
run; 

data &amp;amp;var._zscore; 
	set jobquality_2;
	&amp;amp;var._m = &amp;amp;mean.; 
	&amp;amp;var._s = &amp;amp;std.; 
	&amp;amp;var._z = ((&amp;amp;var.-&amp;amp;var._m)/&amp;amp;var._s); 
	format &amp;amp;var.; 
run; 

*copy label from original var; 
data &amp;amp;var._zscore; 
	set &amp;amp;var._zscore end=eof; 
	if eof then call execute ("label &amp;amp;var._z = "||'"'||strip(vlabel(&amp;amp;var.))||'";');
run;

%mend zscore; 

	%zscore(var=c11); &lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;1                                                          The SAS System                          14:39 Wednesday, October 23, 2024

NOTE: Unable to open SASUSER.REGSTRY. WORK.REGSTRY will be opened instead.
NOTE: All registry changes will be lost at the end of the session.

WARNING: Unable to copy SASUSER registry to WORK registry. Because of this, you will not see registry customizations during this 
         session.
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Copyright (c) 2023 by SAS Institute Inc., Cary, NC, USA. 
NOTE: SAS (r) Proprietary Software 9.4 (TS1M8) 
      Licensed to ABT ASSOCIATES INC - SERVICE PROVIDER, Site 70213852.
NOTE: This session is executing on the X64_DSRV22  platform.



NOTE: Analytical products:
      
      SAS/STAT 15.3
      SAS/ETS 15.3
      SAS/IML 15.3

NOTE: Additional host information:

 X64_DSRV22 WIN 10.0.20348  Server

NOTE: SAS initialization used:
      real time           4.85 seconds
      cpu time            0.31 seconds
      
1          options nofmterr;
2          
3          libname data "S:\projects\HPOG_2.0_Eval\Analysis\01 Data\Special Topics\Job Quality";
NOTE: Libref DATA was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: S:\projects\HPOG_2.0_Eval\Analysis\01 Data\Special Topics\Job Quality
4          libname output "S:\projects\HPOG_2.0_Eval\Analysis\04 Outputs\Special Topics\Job Quality";
NOTE: Libref OUTPUT was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: S:\projects\HPOG_2.0_Eval\Analysis\04 Outputs\Special Topics\Job Quality
5          
6          *read in cleaned data;
7          
8          data jobquality_2;
9          	set data.cleaned_longterm;
10         run;

NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C2DKF was not found or could not be loaded.
NOTE: Format INDUSTRY was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C8AF was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C16DKF was not found or could not be loaded.
&amp;#12;2                                           The SAS System           14:39 Wednesday, October 23, 2024

NOTE: Format INDUSTRY was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C26A_F was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format SCHEDULE was not found or could not be loaded.
NOTE: Format SCHEDULE2_F was not found or could not be loaded.
NOTE: Format SCHEDULE3_F was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format ALOT was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format SATISFIED was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format PROMOTIONS was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format X00001F was not found or could not be loaded.
NOTE: Format INDUSTRY was not found or could not be loaded.
NOTE: There were 1616 observations read from the data set DATA.CLEANED_LONGTERM.
NOTE: The data set WORK.JOBQUALITY_2 has 1616 observations and 59 variables.
NOTE: DATA statement used (Total process time):
      real time           0.19 seconds
      cpu time            0.07 seconds
      

11         
12         *******************************************
13         *caluclate zscores for all variables;
14         
15         %macro zscore(var=,);
16         
17         proc means data = jobquality_2 noprint;
18         	var &amp;amp;var.;
19         	output out = &amp;amp;var._stat;
20         run;
21         
22         *create macro var of var mean &amp;amp; std;
&amp;#12;3                                           The SAS System           14:39 Wednesday, October 23, 2024

23         data _null_;
24         	set &amp;amp;var._stat;
25         	if _STAT_ = "MEAN" then call symputx('mean',&amp;amp;var.);
26         	if _STAT_ = "STD" then call symputx('std',&amp;amp;var.);
27         run;
28         
29         data &amp;amp;var._zscore;
30         	set jobquality_2;
31         	&amp;amp;var._m = &amp;amp;mean.;
32         	&amp;amp;var._s = &amp;amp;std.;
33         	&amp;amp;var._z = ((&amp;amp;var.-&amp;amp;var._m)/&amp;amp;var._s);
34         	format &amp;amp;var.;
35         run;
36         
37         *copy label from original var;
38         data &amp;amp;var._zscore;
39         	set &amp;amp;var._zscore end=eof;
40         	if eof then call execute ("label &amp;amp;var._z = "||'"'||strip(vlabel(&amp;amp;var.))||'";');
41         run;
42         
43         %mend zscore;
44         
45         	%zscore(var=c11);

NOTE: There were 1616 observations read from the data set WORK.JOBQUALITY_2.
NOTE: The data set WORK.C11_STAT has 5 observations and 4 variables.
NOTE: PROCEDURE MEANS used (Total process time):
      real time           0.10 seconds
      cpu time            0.03 seconds
      


NOTE: There were 5 observations read from the data set WORK.C11_STAT.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds
      


NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C2DKF was not found or could not be loaded.
NOTE: Format INDUSTRY was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C8AF was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C16DKF was not found or could not be loaded.
NOTE: Format INDUSTRY was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C26A_F was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format SCHEDULE was not found or could not be loaded.
NOTE: Format SCHEDULE2_F was not found or could not be loaded.
&amp;#12;4                                           The SAS System           14:39 Wednesday, October 23, 2024

NOTE: Format SCHEDULE3_F was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format ALOT was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format SATISFIED was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format PROMOTIONS was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format X00001F was not found or could not be loaded.
NOTE: Format INDUSTRY was not found or could not be loaded.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1545 at 61:120   
NOTE: There were 1616 observations read from the data set WORK.JOBQUALITY_2.
NOTE: The data set WORK.C11_ZSCORE has 1616 observations and 62 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      


NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C2DKF was not found or could not be loaded.
NOTE: Format INDUSTRY was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C8AF was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C16DKF was not found or could not be loaded.
NOTE: Format INDUSTRY was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format C26A_F was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format SCHEDULE was not found or could not be loaded.
&amp;#12;5                                           The SAS System           14:39 Wednesday, October 23, 2024

NOTE: Format SCHEDULE2_F was not found or could not be loaded.
NOTE: Format SCHEDULE3_F was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format ALOT was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format SATISFIED was not found or could not be loaded.
NOTE: Format AGREE was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format PROMOTIONS was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format YESNO was not found or could not be loaded.
NOTE: Format X00001F was not found or could not be loaded.
NOTE: Format INDUSTRY was not found or could not be loaded.
NOTE: There were 1616 observations read from the data set WORK.C11_ZSCORE.
NOTE: The data set WORK.C11_ZSCORE has 1616 observations and 62 variables.
NOTE: DATA statement used (Total process time):
      real time           0.05 seconds
      cpu time            0.03 seconds
      

NOTE: CALL EXECUTE generated line.
NOTE: Line generated by the CALL EXECUTE routine.
1         + label c11_z = "C11. About how much did you typically earn per hour before taxes?";
            _____
            180

ERROR 180-322: Statement is not valid or it is used out of proper order.

46         	%zscore(var=c11a);

NOTE: The SAS System stopped processing this step because of errors.
NOTE: Due to ERROR(s) above, SAS set option OBS=0, enabling syntax check mode. 
      This prevents execution of subsequent data modification statements.
WARNING: The data set WORK.C11A_STAT may be incomplete.  When this step was stopped there were 0 
         observations and 0 variables.
NOTE: PROCEDURE MEANS used (Total process time):
      real time           0.00 seconds
&amp;#12;6                                           The SAS System           14:39 Wednesday, October 23, 2024

      cpu time            0.01 seconds
      



NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

386: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 386-185: Expecting an arithmetic expression.
200: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Apparent symbolic reference MEAN not resolved.
386: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 386-185: Expecting an arithmetic expression.
200: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Apparent symbolic reference STD not resolved.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.C11A_ZSCORE may be incomplete.  When this step was stopped there were 0 
         observations and 62 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds
      


NOTE: The data set WORK.C11A_ZSCORE has 0 observations and 62 variables.
WARNING: Data set WORK.C11A_ZSCORE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

47         	%zscore(var=c13);

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.C13_STAT may be incomplete.  When this step was stopped there were 0 
         observations and 0 variables.
NOTE: PROCEDURE MEANS used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      
&amp;#12;7                                           The SAS System           14:39 Wednesday, October 23, 2024




NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

386: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 386-185: Expecting an arithmetic expression.
200: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Apparent symbolic reference MEAN not resolved.
386: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 386-185: Expecting an arithmetic expression.
200: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Apparent symbolic reference STD not resolved.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.C13_ZSCORE may be incomplete.  When this step was stopped there were 0 
         observations and 62 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      


NOTE: The data set WORK.C13_ZSCORE has 0 observations and 62 variables.
WARNING: Data set WORK.C13_ZSCORE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

48         	%zscore(var=c18);

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.C18_STAT may be incomplete.  When this step was stopped there were 0 
         observations and 0 variables.
NOTE: PROCEDURE MEANS used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      


&amp;#12;8                                           The SAS System           14:39 Wednesday, October 23, 2024


NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

386: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 386-185: Expecting an arithmetic expression.
200: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Apparent symbolic reference MEAN not resolved.
386: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 386-185: Expecting an arithmetic expression.
200: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Apparent symbolic reference STD not resolved.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.C18_ZSCORE may be incomplete.  When this step was stopped there were 0 
         observations and 62 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      


NOTE: The data set WORK.C18_ZSCORE has 0 observations and 62 variables.
WARNING: Data set WORK.C18_ZSCORE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

49         	%zscore(var=c18a);
ERROR: Variable C18A not found.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.C18A_STAT may be incomplete.  When this step was stopped there were 0 
         observations and 0 variables.
NOTE: PROCEDURE MEANS used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      


NOTE: DATA statement used (Total process time):
&amp;#12;9                                           The SAS System           14:39 Wednesday, October 23, 2024

      real time           0.00 seconds
      cpu time            0.00 seconds
      

386: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 386-185: Expecting an arithmetic expression.
200: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Apparent symbolic reference MEAN not resolved.
386: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 386-185: Expecting an arithmetic expression.
200: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where 
      the error has occurred.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Apparent symbolic reference STD not resolved.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.C18A_ZSCORE may be incomplete.  When this step was stopped there were 0 
         observations and 63 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      


NOTE: The data set WORK.C18A_ZSCORE has 0 observations and 63 variables.
WARNING: Data set WORK.C18A_ZSCORE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      


ERROR: Errors printed on pages 5,6,7,8,9.

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
      real time           5.64 seconds
      cpu time            0.56 seconds
      &lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2024 18:46:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute-to-label-variables-getting-statement-not-valid/m-p/948803#M371191</guid>
      <dc:creator>colleenbogucki</dc:creator>
      <dc:date>2024-10-23T18:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Call execute to label variables getting statement not valid error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-to-label-variables-getting-statement-not-valid/m-p/948805#M371192</link>
      <description>&lt;P&gt;CALL EXECUTE works after the data step it is in finishes. So ... LABEL statement outside of a DATA step or PROC is not allowed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't use CALL EXECUTE here, just include the LABEL statement in the DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I point out that looping through variables one variable at a time in a macro is an extremely inefficient way of doing most things. Better to figure out how to handle all variables in one pass. Storing means and standard deviations in a macro variable is unnecessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;EVEN BETTER APPROACH&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;SAS has an extremely wide ranging set of PROCs to perform statistical and other analyses, you should try to find a PROC that does what you want before resorting to macros. I see you performing a standard statistical calculation like this (which is called standardizing):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;amp;var._z = ((&amp;amp;var.-&amp;amp;var._m)/&amp;amp;var._s); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Surely there is a PROC that will standardize your variables! In fact there is a PROC, it is called PROC STDIZE. The entire macro and all the looping is unnecessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So except for your label statement, none of this looping or macro is necessary, and this ought to get you what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdize data=jobquality_2 method=std out=jobquality_2z oprefix=o_ sprefix=z_;
     var c1-c31; /* or whatever the variable names are */
run;
     &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so your standardized values and original values are now in data set jobquality_2z&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 21:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute-to-label-variables-getting-statement-not-valid/m-p/948805#M371192</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-10-23T21:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Call execute to label variables getting statement not valid error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-to-label-variables-getting-statement-not-valid/m-p/948890#M371224</link>
      <description>&lt;P&gt;Adding: Using PROC STDIZE, the new standardzied variables automatically get the same label as the original variables.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 13:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute-to-label-variables-getting-statement-not-valid/m-p/948890#M371224</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-10-24T13:53:07Z</dc:date>
    </item>
  </channel>
</rss>

