Re: Strange behavior of VARIABLE LABELS in macro

Posted by Rick Oliver-3 on
URL: http://spssx-discussion.165.s1.nabble.com/Revision-control-for-SPSS-source-code-tp4267835p4267998.html

I'm not a macro expert, but the first thing I'd do is SET MPRINT ON before calling the macro to see what the generated syntax is.



From:        ANDRES ALBERTO BURGA LEON <[hidden email]>
To:        [hidden email]
Date:        03/28/2011 12:12 PM
Subject:        Strange behavior of VARIABLE LABELS in macro
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





Hello to everybody:


When I run this simple macro:


************************************************************************.

DEFINE !separar_ie (evaluacion = !CHAREND('/') / codigo =!CHAREND('/')).


DATASET COPY  !evaluacion.

DATASET ACTIVATE  !evaluacion.

FILTER OFF.

USE ALL.

SELECT IF (cod_eva = !codigo).

EXECUTE.


SORT CASES BY prioridad (A) codgeo (A) corre_med (A) cod_al (A).

DELETE VARIABLES casos_ie_C_10 casos_ie_M_10 cen_pob region26 TO nombres.


COMPUTE correlativo=$CASENUM.

EXECUTE.

ALTER TYPE correlativo (F6.0).


VARIABLE LABELS

cod_eva V001

correlativo V002

prioridad V003

codgeo        V004

corre_med V005

cod_mod7 V006

anexo V007

nom_nino V008

ie V009

ubicacion V010

en_cl V011

texto1_C V012

en_m V013

texto1_M V014

se_ubica_C V015

nivel_C        V016

texto2_C V017

se_ubica_M V018

nivel_M        V019

texto2_M V020

p_g3_ie_C_10 V021

p_g2_ie_C_10 V022

p_g1_ie_C_10 V023

p_g3_ie_M_10 V024

p_g2_ie_M_10 V025

p_g1_ie_M_10 V026.


SORT VARIABLES BY LABEL.


SAVE OUTFILE=!QUOTE(!CONCAT('D:\Censo Alumnos 2010\Documentos\Reportes\Segundo\Padres\Reporte Padres 2do ',!evaluacion,'.sav'))

/COMPRESSED.


DATASET ACTIVATE  Reporte_padres.


!ENDDEFINE.


!separar_ie evaluacion = MC / codigo = 2.


************************************************************************.


I get an error message:


Warning # 4463 in column 25.  Text: V001 correlativo V002 prioridad V003 codgeo V004 corre_med V005

A label specified on the VAR LABELS command contains more than 256 characters.

The label will be truncated to 256 characters.


 

If I run the VARIABLE LABELS outside the macro, I don't get the error, and every variable gets its correct label.


I can run the VARIABLE LABELS like this:


VARIABLE LABELS

cod_eva 'V001'

correlativo 'V002'

prioridad 'V003'

codgeo        'V004'.


inside the macro and works fine. I'm triying to understand why something like:


VARIABLE LABELS

cod_eva V001

correlativo V002

prioridad V003

codgeo        V004.


doesn't works inside the macro,


Kindly


Andrés


Mg. Andrés Burga León
Coordinador de Análisis e Informática
Unidad de Medición de la Calidad Educativa
Ministerio de Educación del Perú
Calle El Comercio s/n (espalda del Museo de la Nación)
Lima 41
Perú
Teléfono 615-5840