Automatically modifying value labels

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Automatically modifying value labels

Luca Meyer
Hello,

I export a Bellview file with numerical variables carrying value labels of
the sort:

0="-"
1="+"

And variable labels each different from the other (later on addressed as [V1
VAR LABEL], [V2 VAR LABEL), ecc.

I would need to create MRSETS out of such variables so I am looking for a
procedure that automatically generates/performs a syntax as the following:

Suppose I have 10 variables such as those described, V1 to V10. The sintax I
would need to generate looks like:

RECODE V1 (0=SYSMIS).
RECODE V2 (0=SYSMIS) (1=2).
RECODE V3 (0=SYSMIS) (1=3).
RECODE V4 (0=SYSMIS) (1=4).
RECODE V5 (0=SYSMIS) (1=5).
RECODE V6 (0=SYSMIS) (1=6).
RECODE V7 (0=SYSMIS) (1=7).
RECODE V8 (0=SYSMIS) (1=8).
RECODE V9 (0=SYSMIS) (1=9).
RECODE V10 (0=SYSMIS) (1=10).

VAL LABEL V1 1 "[V1 VAR LABEL]".
VAL LABEL V2 2 "[V2 VAR LABEL]".
VAL LABEL V3 3 "[V3 VAR LABEL]".
VAL LABEL V4 4 "[V4 VAR LABEL]".
VAL LABEL V5 5 "[V5 VAR LABEL]".
VAL LABEL V6 6 "[V6 VAR LABEL]".
VAL LABEL V7 7 "[V7 VAR LABEL]".
VAL LABEL V8 8 "[V8 VAR LABEL]".
VAL LABEL V9 9 "[V9 VAR LABEL]".
VAL LABEL V10 10 "[V10 VAR LABEL]".

So that I can later on create a MRSET:

MRSETS /MCGROUP NAME=$V1_V10 VARIABLES=V1 TO V10 /DISPLAY NAME=[$V1_V10].

The challenge is to make the procedure easily adaptable to different set of
variables without need for writing it out each time - something like
!PROCEDURE VX TO VY where VX and VY are the extreme of a set of variables to
be included in the MRSET.

Thank you in advance for any suggestion you might have.


Luca

Mr. Luca MEYER
Market research, data analysis & more
www.lucameyer.com <http://www.lucameyer.com/>  - Tel: +39.339.495.00.21