Dear friends of List
I want to make a MACRO that receives a list from variables and after that makes the CTABLES. For example: (Three variables V1, v2 and V3). The variable BASE is no modified. The paste syntax make: * Custom Tables. CTABLES /VLABELS VARIABLES=BASE VALOR_HIPOTECA_ALIENACAO TEMPO_ATIVIDADE TEMPO_ATIVIDADE_EMP DISPLAY=DEFAULT /TABLE V1 [S][MEAN, MEDIAN, RANGE, STDDEV] + V2 [S][MEAN, MEDIAN, RANGE, STDDEV] + V3 [S][MEAN, MEDIAN, RANGE, STDDEV] BY BASE [C] /CATEGORIES VARIABLES=BASE ORDER=A KEY=VALUE EMPTY=EXCLUDE. I am trying using this: DEFINE NomesVariaveisNumericas() V1 V2 V3 !ENDDEFINE. DEFINE GeraEstatisticasNumericas (DiretorioAnalise=!TOKENS(1) / VariaveisNum=!CMDEND) CTABLES /VLABELS VARIABLES= Base !VariaveisNum DISPLAY=DEFAULT /TABLE !DO !V !IN ((!VariaveisNum) + !V) !DOEND [S][MEAN 'Média', MEDIAN 'Mediana', RANGE 'Amplitude', STDDEV] BY base [C] /CATEGORIES VARIABLES=base ORDER=A KEY=VALUE EMPTY=EXCLUDE. !ENDDEFINE. GeraEstatisticasNumericas VariaveisNum=NomesVariaveisNumericas. The error is TABLE: Text [. The syntax contains an invalid sequence of operators and parentheses. This command is not executed. Please If you can help me very much thanks. Carlos Renato. |
Hi Renato,
try this: DEFINE GeraEstatisticasNumericas (DiretorioAnalise=!TOKENS(1) / VariaveisNum=!CMDEND) !let !h=!head(!VariaveisNum) !let !t=!tail(!VariaveisNum) CTABLES /VLABELS VARIABLES= Base !VariaveisNum DISPLAY=DEFAULT /TABLE !h !DO !V !IN (!t) + !V !DOEND [S][MEAN 'Média', MEDIAN 'Mediana', RANGE 'Amplitude', STDDEV] BY base [C] /CATEGORIES VARIABLES=base ORDER=A KEY=VALUE EMPTY=EXCLUDE. !ENDDEFINE. hope it works Regards! Vlad. On 9/19/06, Carlos Renato <[hidden email]> wrote: > > Dear friends of List > > I want to make a MACRO that receives a list from variables and after > that makes the CTABLES. > For example: (Three variables V1, v2 and V3). The variable BASE is no > modified. > > The paste syntax make: > > * Custom Tables. > CTABLES > /VLABELS VARIABLES=BASE VALOR_HIPOTECA_ALIENACAO TEMPO_ATIVIDADE > TEMPO_ATIVIDADE_EMP DISPLAY=DEFAULT > /TABLE V1 [S][MEAN, MEDIAN, RANGE, STDDEV] + V2 [S][MEAN, MEDIAN, RANGE, > STDDEV] + > V3 [S][MEAN, MEDIAN, RANGE, STDDEV] BY BASE [C] > /CATEGORIES VARIABLES=BASE ORDER=A KEY=VALUE EMPTY=EXCLUDE. > I am trying using this: > > DEFINE NomesVariaveisNumericas() > V1 > V2 > V3 > !ENDDEFINE. > > DEFINE GeraEstatisticasNumericas (DiretorioAnalise=!TOKENS(1) / > VariaveisNum=!CMDEND) > CTABLES > /VLABELS VARIABLES= Base !VariaveisNum > DISPLAY=DEFAULT > /TABLE > !DO !V !IN ((!VariaveisNum) + !V) !DOEND [S][MEAN 'Média', MEDIAN > 'Mediana', RANGE 'Amplitude', STDDEV] > BY base [C] > /CATEGORIES VARIABLES=base ORDER=A KEY=VALUE EMPTY=EXCLUDE. > !ENDDEFINE. > GeraEstatisticasNumericas VariaveisNum=NomesVariaveisNumericas. > > The error is TABLE: Text [. The syntax contains an invalid sequence of > operators and parentheses. > This command is not executed. > > Please If you can help me very much thanks. > > Carlos Renato. > -- Vlad Simion Data Analyst Tel: +40 720130611 |
In reply to this post by Carlos Renato-2
Hello Carlos,
Im affraid your macro definition is not correct - it produced error >A macro expression includes an operator which is syntactically correct but which has not yet been implemented in the macro language. But maybe that is due to my older SPSS version (12) and now is already right. This is the part of macro: !DO !V !IN ((!VariaveisNum) + !V) !DOEND (see DEFINE command syntax at your version SPSS help). There is also a diret... parameter specified but not used in macro what I suspect is wrong. Not easy to recognize what you wish to do, in case you wont to make the same tables with variable V1 then V2 and V3 the following could work: DEFINE GeraEstatisticasNumericas (VariaveisNum=!CMDEND) !DO !V !IN ((!VariaveisNum) ) CTABLES /VLABELS VARIABLES=BASE VALOR_HIPOTECA_ALIENACAO TEMPO_ATIVIDADE TEMPO_ATIVIDADE_EMP DISPLAY=DEFAULT /TABLE !V [S][MEAN, MEDIAN, RANGE, STDDEV] BY BASE [C] /CATEGORIES VARIABLES=BASE ORDER=A KEY=VALUE EMPTY=EXCLUDE. !DOEND !ENDDEFINE. GeraEstatisticasNumericas VariaveisNum= V1 V2 V3 . Finaly pls allow me to remind of the command SET mprint=on which can help a lot with macro debugging. HTH Jindra > ------------ Původní zpráva ------------ > Od: Carlos Renato <[hidden email]> > Předmět: Problems with CTABLES Macros > Datum: 19.9.2006 19:56:48 > ---------------------------------------- > Dear friends of List > > I want to make a MACRO that receives a list from variables and after > that makes the CTABLES. > For example: (Three variables V1, v2 and V3). The variable BASE is no > modified. > > The paste syntax make: > > * Custom Tables. > CTABLES > /VLABELS VARIABLES=BASE VALOR_HIPOTECA_ALIENACAO TEMPO_ATIVIDADE > TEMPO_ATIVIDADE_EMP DISPLAY=DEFAULT > /TABLE V1 [S][MEAN, MEDIAN, RANGE, STDDEV] + V2 [S][MEAN, MEDIAN, RANGE, > STDDEV] + > V3 [S][MEAN, MEDIAN, RANGE, STDDEV] BY BASE [C] > /CATEGORIES VARIABLES=BASE ORDER=A KEY=VALUE EMPTY=EXCLUDE. > I am trying using this: > > DEFINE NomesVariaveisNumericas() > V1 > V2 > V3 > !ENDDEFINE. > > DEFINE GeraEstatisticasNumericas (DiretorioAnalise=!TOKENS(1) / > VariaveisNum=!CMDEND) > CTABLES > /VLABELS VARIABLES= Base !VariaveisNum > DISPLAY=DEFAULT > /TABLE > !DO !V !IN ((!VariaveisNum) + !V) !DOEND [S][MEAN 'Média', MEDIAN > 'Mediana', RANGE 'Amplitude', STDDEV] > BY base [C] > /CATEGORIES VARIABLES=base ORDER=A KEY=VALUE EMPTY=EXCLUDE. > !ENDDEFINE. > GeraEstatisticasNumericas VariaveisNum=NomesVariaveisNumericas. > > The error is TABLE: Text [. The syntax contains an invalid sequence of > operators and parentheses. > This command is not executed. > > Please If you can help me very much thanks. > > Carlos Renato. > > > |
Dear Friends Vlad Simon, Jerabek Jindrich and List
Vlad Simon Its macro is good and functioned, but it did not calculate all the measures for the all variables. The MEAN is calculate for all, but the others meansures MEDIAN, RANGE and STDDEV is no calculated. Only the last variable have all meansures calculated. If you have a soluction for this problem very much thanks . Jerabek Jindrich Its macro is good and functioned, all meansures is calculated for the all variables. But it generates a table for each 0 variable, we want everything in one same table. Very much thanks too. The macros created with your contribuitions.. /************************************************************************************** DEFINE NomesVariaveisNumericas () V1 V2 V3 !ENDDEFINE. /*vlad simion <[hidden email]> DEFINE GeraEstatisticasNumericas (VariaveisNum=!CMDEND) !let !h=!head(!VariaveisNum) !let !t=!tail(!VariaveisNum) CTABLES /VLABELS VARIABLES= Base !VariaveisNum DISPLAY=DEFAULT /TABLE !h !DO !V !IN (!t) + !V !DOEND [S][MEAN 'Média', MEDIAN 'Mediana', RANGE 'Amplitude', STDDEV] BY base [C] /CATEGORIES VARIABLES=base ORDER=A KEY=VALUE EMPTY=EXCLUDE. !ENDDEFINE. GeraEstatisticasNumericas DiretorioAnalise='C:\Documents and Settings\crs\Desktop\CTABLES in Macro' VariaveisNum=NomesVariaveisNumericas. /********************************************************************************************* DEFINE NomesVariaveisNumericas () V1 V2 V3 !ENDDEFINE. /* Jerabek Jindrich <[hidden email]> DEFINE GeraEstatisticasNumericas (VariaveisNum=!CMDEND) !DO !V !IN ((!VariaveisNum) ) CTABLES /VLABELS VARIABLES=V1 V2 V3 DISPLAY=DEFAULT /TABLE !V [S][MEAN, MEDIAN, RANGE, STDDEV] BY BASE [C] /CATEGORIES VARIABLES=BASE ORDER=A KEY=VALUE EMPTY=EXCLUDE. !DOEND !ENDDEFINE. GeraEstatisticasNumericas VariaveisNum=NomesVariaveisNumericas . /********************************************************************************* EXAMPLE OF OUTPUT FOR THE FIRST MACRO: The meansures no calculated for all variables.... BASE .0000 1.0000 Mean Mediana Amplitude Standard Deviation Mean Mediana Amplitude Standard Deviation VALOR_HIPOTECA_ALIENACAO 22226.9564 17095.3710 TEMPO_ATIVIDADE 967.1147 277.1802 TEMPO_ATIVIDADE_EMP 1215.7872 993.2594 TEMPO_ATIVIDADE_EMP_CREDITO 2.7689 .3420 PREVISAO_MENSAL_GASOLINA 2311.0564 42.3605 PREVISAO_MENSAL_DIESEL 2903.7894 56.6801 PREVISAO_MENSAL_ALCOOL 203.3804 3.8369 QTDE_SOCIOS 1.9432 1.8183 PERCENTUAL_MAIOR_PARTICIPACAO_SOCIO 68.5535 63.6439 TEMPO_SOCIO_MAIS_RECENTE 37227.3847 1723.0322 QTDE_REFERENCIAS_BANCARIAS 1.2271 1.1261 QTDE_REFERENCIAS_COMERCIAIS 2.2024 2.0863 QTDE_BENS 1.9070 2.4950 QTDE_GRUPOS_PARTICIPANTES 2.4046 2.1830 QTDE_CNPJ_BASE 1.5773 1.3793 QTDE_TOTAL_GRUPO 2.4046 2.1830 LIMITE_TOTAL_GRUPO 166662.2953 143895.7249 LIMITE_MEDIO_GRUPO 79246.9566 55000.0000 550000.0000 86674.0337 59511.6487 45000.0000 550000.0000 66743.3143 Very much thanks... Carlos Renato Statistician Recife-PE-Brazil +55(81) 3581.1246 |
Hi Renato,
sorry for the previous syntax. DEFINE GeraEstatisticasNumericas (VariaveisNum=!CMDEND) !let !h=!head(!VariaveisNum) !let !t=!tail(!VariaveisNum) CTABLES /VLABELS VARIABLES= base !VariaveisNum DISPLAY=DEFAULT /TABLE !h [S][MEAN 'Média', MEDIAN 'Mediana', RANGE 'Amplitude', STDDEV] !DO !V !IN (!t) + !V [S][MEAN 'Média', MEDIAN 'Mediana', RANGE 'Amplitude', STDDEV] !DOEND BY base [C] /CATEGORIES VARIABLES=base ORDER=A KEY=VALUE EMPTY=EXCLUDE. !ENDDEFINE. Regards! Vlad. On 9/20/06, Carlos Renato <[hidden email]> wrote: > > Dear Friends Vlad Simon, Jerabek Jindrich and List > > Vlad Simon > > Its macro is good and functioned, but it did not calculate all the > measures > for the all variables. The MEAN is calculate for all, but the others > meansures MEDIAN, RANGE > and STDDEV is no calculated. Only the last variable have all meansures > calculated. > If you have a soluction for this problem very much thanks . > > Jerabek Jindrich > Its macro is good and functioned, all meansures is calculated for the all > variables. > But it generates a table for each 0 variable, we want everything in one > same > table. > Very much thanks too. > > The macros created with your contribuitions.. > > /************************************************************************************** > DEFINE NomesVariaveisNumericas () > V1 > V2 > V3 > !ENDDEFINE. > /*vlad simion <[hidden email]> > DEFINE GeraEstatisticasNumericas (VariaveisNum=!CMDEND) > !let !h=!head(!VariaveisNum) > !let !t=!tail(!VariaveisNum) > CTABLES > /VLABELS VARIABLES= Base !VariaveisNum > DISPLAY=DEFAULT > /TABLE !h !DO !V !IN (!t) + !V !DOEND [S][MEAN 'Média', MEDIAN 'Mediana', > RANGE 'Amplitude', STDDEV] > BY base [C] > /CATEGORIES VARIABLES=base ORDER=A KEY=VALUE EMPTY=EXCLUDE. > !ENDDEFINE. > GeraEstatisticasNumericas DiretorioAnalise='C:\Documents and > Settings\crs\Desktop\CTABLES in Macro' > VariaveisNum=NomesVariaveisNumericas. > > /********************************************************************************************* > > DEFINE NomesVariaveisNumericas () > V1 > V2 > V3 > !ENDDEFINE. > /* Jerabek Jindrich <[hidden email]> > DEFINE GeraEstatisticasNumericas (VariaveisNum=!CMDEND) > !DO !V !IN ((!VariaveisNum) ) > CTABLES > /VLABELS VARIABLES=V1 V2 V3 > DISPLAY=DEFAULT > /TABLE !V [S][MEAN, MEDIAN, RANGE, STDDEV] BY BASE [C] > /CATEGORIES VARIABLES=BASE ORDER=A KEY=VALUE EMPTY=EXCLUDE. > !DOEND > !ENDDEFINE. > GeraEstatisticasNumericas VariaveisNum=NomesVariaveisNumericas . > > /********************************************************************************* > EXAMPLE OF OUTPUT FOR THE FIRST MACRO: The meansures no > calculated for all variables.... > > > BASE > .0000 > 1.0000 > Mean > Mediana > Amplitude > Standard Deviation > Mean > Mediana > Amplitude > Standard Deviation > VALOR_HIPOTECA_ALIENACAO > 22226.9564 > > > > 17095.3710 > > > > TEMPO_ATIVIDADE > 967.1147 > > > > 277.1802 > > > > TEMPO_ATIVIDADE_EMP > 1215.7872 > > > > 993.2594 > > > > TEMPO_ATIVIDADE_EMP_CREDITO > 2.7689 > > > > .3420 > > > > PREVISAO_MENSAL_GASOLINA > 2311.0564 > > > > 42.3605 > > > > PREVISAO_MENSAL_DIESEL > 2903.7894 > > > > 56.6801 > > > > PREVISAO_MENSAL_ALCOOL > 203.3804 > > > > 3.8369 > > > > QTDE_SOCIOS > 1.9432 > > > > 1.8183 > > > > PERCENTUAL_MAIOR_PARTICIPACAO_SOCIO > 68.5535 > > > > 63.6439 > > > > TEMPO_SOCIO_MAIS_RECENTE > 37227.3847 > > > > 1723.0322 > > > > QTDE_REFERENCIAS_BANCARIAS > 1.2271 > > > > 1.1261 > > > > QTDE_REFERENCIAS_COMERCIAIS > 2.2024 > > > > 2.0863 > > > > QTDE_BENS > 1.9070 > > > > 2.4950 > > > > QTDE_GRUPOS_PARTICIPANTES > 2.4046 > > > > 2.1830 > > > > QTDE_CNPJ_BASE > 1.5773 > > > > 1.3793 > > > > QTDE_TOTAL_GRUPO > 2.4046 > > > > 2.1830 > > > > LIMITE_TOTAL_GRUPO > 166662.2953 > > > > 143895.7249 > > > > LIMITE_MEDIO_GRUPO > 79246.9566 > 55000.0000 > 550000.0000 > 86674.0337 > 59511.6487 > 45000.0000 > 550000.0000 > 66743.3143 > > > Very much thanks... > > Carlos Renato > Statistician > Recife-PE-Brazil > +55(81) 3581.1246 > -- Vlad Simion Data Analyst Tel: +40 720130611 |
Friend Vlad Simion, Jerabek Jindrich and List
Very much thanks, the last mail of Vlad solves the problem. Thanks a million for all. Carlos Renato Statistician +55 (81)35811246 2006/9/20, vlad simion <[hidden email]>: > > Hi Renato, > > sorry for the previous syntax. > > > DEFINE GeraEstatisticasNumericas (VariaveisNum=!CMDEND) > !let !h=!head(!VariaveisNum) > !let !t=!tail(!VariaveisNum) > CTABLES > /VLABELS VARIABLES= base !VariaveisNum > DISPLAY=DEFAULT > /TABLE !h [S][MEAN 'Média', MEDIAN 'Mediana', RANGE 'Amplitude', STDDEV] > !DO !V !IN (!t) + !V [S][MEAN 'Média', MEDIAN 'Mediana', RANGE 'Amplitude', > STDDEV] !DOEND > > BY base [C] > /CATEGORIES VARIABLES=base ORDER=A KEY=VALUE EMPTY=EXCLUDE. > !ENDDEFINE. > > Regards! > > > Vlad. > > > On 9/20/06, Carlos Renato <[hidden email]> wrote: > > > > Dear Friends Vlad Simon, Jerabek Jindrich and List > > > > Vlad Simon > > > > Its macro is good and functioned, but it did not calculate all the > > measures > > for the all variables. The MEAN is calculate for all, but the others > > meansures MEDIAN, RANGE > > and STDDEV is no calculated. Only the last variable have all meansures > > calculated. > > If you have a soluction for this problem very much thanks . > > > > Jerabek Jindrich > > Its macro is good and functioned, all meansures is calculated for the > > all > > variables. > > But it generates a table for each 0 variable, we want everything in one > > same > > table. > > Very much thanks too. > > > > The macros created with your contribuitions.. > > > > /************************************************************************************** > > DEFINE NomesVariaveisNumericas () > > V1 > > V2 > > V3 > > !ENDDEFINE. > > /*vlad simion < [hidden email]> > > DEFINE GeraEstatisticasNumericas (VariaveisNum=!CMDEND) > > !let !h=!head(!VariaveisNum) > > !let !t=!tail(!VariaveisNum) > > CTABLES > > /VLABELS VARIABLES= Base !VariaveisNum > > DISPLAY=DEFAULT > > /TABLE !h !DO !V !IN (!t) + !V !DOEND [S][MEAN 'Média', MEDIAN > > 'Mediana', > > RANGE 'Amplitude', STDDEV] > > BY base [C] > > /CATEGORIES VARIABLES=base ORDER=A KEY=VALUE EMPTY=EXCLUDE. > > !ENDDEFINE. > > GeraEstatisticasNumericas DiretorioAnalise='C:\Documents and > > Settings\crs\Desktop\CTABLES in Macro' > > VariaveisNum=NomesVariaveisNumericas. > > /********************************************************************************************* > > > > > > DEFINE NomesVariaveisNumericas () > > V1 > > V2 > > V3 > > !ENDDEFINE. > > /* Jerabek Jindrich <[hidden email]> > > DEFINE GeraEstatisticasNumericas (VariaveisNum=!CMDEND) > > !DO !V !IN ((!VariaveisNum) ) > > CTABLES > > /VLABELS VARIABLES=V1 V2 V3 > > DISPLAY=DEFAULT > > /TABLE !V [S][MEAN, MEDIAN, RANGE, STDDEV] BY BASE [C] > > /CATEGORIES VARIABLES=BASE ORDER=A KEY=VALUE EMPTY=EXCLUDE. > > !DOEND > > !ENDDEFINE. > > GeraEstatisticasNumericas VariaveisNum=NomesVariaveisNumericas . > > > > /********************************************************************************* > > EXAMPLE OF OUTPUT FOR THE FIRST MACRO: The meansures no > > calculated for all variables.... > > > > > > BASE > > .0000 > > 1.0000 > > Mean > > Mediana > > Amplitude > > Standard Deviation > > Mean > > Mediana > > Amplitude > > Standard Deviation > > VALOR_HIPOTECA_ALIENACAO > > 22226.9564 > > > > > > > > 17095.3710 > > > > > > > > TEMPO_ATIVIDADE > > 967.1147 > > > > > > > > 277.1802 > > > > > > > > TEMPO_ATIVIDADE_EMP > > 1215.7872 > > > > > > > > 993.2594 > > > > > > > > TEMPO_ATIVIDADE_EMP_CREDITO > > 2.7689 > > > > > > > > .3420 > > > > > > > > PREVISAO_MENSAL_GASOLINA > > 2311.0564 > > > > > > > > 42.3605 > > > > > > > > PREVISAO_MENSAL_DIESEL > > 2903.7894 > > > > > > > > 56.6801 > > > > > > > > PREVISAO_MENSAL_ALCOOL > > 203.3804 > > > > > > > > 3.8369 > > > > > > > > QTDE_SOCIOS > > 1.9432 > > > > > > > > 1.8183 > > > > > > > > PERCENTUAL_MAIOR_PARTICIPACAO_SOCIO > > 68.5535 > > > > > > > > 63.6439 > > > > > > > > TEMPO_SOCIO_MAIS_RECENTE > > 37227.3847 > > > > > > > > 1723.0322 > > > > > > > > QTDE_REFERENCIAS_BANCARIAS > > 1.2271 > > > > > > > > 1.1261 > > > > > > > > QTDE_REFERENCIAS_COMERCIAIS > > 2.2024 > > > > > > > > 2.0863 > > > > > > > > QTDE_BENS > > 1.9070 > > > > > > > > 2.4950 > > > > > > > > QTDE_GRUPOS_PARTICIPANTES > > 2.4046 > > > > > > > > 2.1830 > > > > > > > > QTDE_CNPJ_BASE > > 1.5773 > > > > > > > > 1.3793 > > > > > > > > QTDE_TOTAL_GRUPO > > 2.4046 > > > > > > > > 2.1830 > > > > > > > > LIMITE_TOTAL_GRUPO > > 166662.2953 > > > > > > > > 143895.7249 > > > > > > > > LIMITE_MEDIO_GRUPO > > 79246.9566 > > 55000.0000 > > 550000.0000 > > 86674.0337 > > 59511.6487 > > 45000.0000 > > 550000.0000 > > 66743.3143 > > > > > > Very much thanks... > > > > Carlos Renato > > Statistician > > Recife-PE-Brazil > > +55(81) 3581.1246 > > > > > > -- > Vlad Simion > Data Analyst > Tel: +40 720130611 > |
Free forum by Nabble | Edit this page |