Re: Uniform data width for the ID variable?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Uniform data width for the ID variable?

Dennis Deck
Some options are:
 a) add a constant (eg 100 or 1000) so all IDs have same number of
digits (99 becomes 199 or 1099)
 b) convert to a string and add a leading '0' if <100

I don't remember if HLM cares whether the ID is numeric or string .

Dennis Deck

-----Original Message-----
From: Judith Saebel [mailto:[hidden email]]
Sent: Wednesday, September 12, 2007 1:32 AM
Subject: Uniform data width for the ID variable?

Dear All,

I've been asked to adjust a .sav file to be used in HLM (6.04) so that
the data in the ID variable have a uniform width.  For example, if the
largest value is 300, then anything smaller than 100 has to start with a
0 (099, 078, etc.) or two zeroes (001, 005, etc.).  I was told that this
is a better way to set up the data file(s), before importing them into
HLM.

I've never head of this so I'd appreciate your views.

Many thanks in advance,

Judith Saebel

-------------------------- Multilevel list --------------------------
To leave, send    leave multilevel    to [hidden email]
For further info about the Multilevel list, please see
http://www.jiscmail.ac.uk/lists/multilevel.html     and
http://www.nursing.teaching.man.ac.uk/staff/mcampbell/multilevel.html
Reply | Threaded
Open this post in threaded view
|

Re: Uniform data width for the ID variable?

Albert-Jan Roskam
hi,

This is a solution that appeared on spss-l the other
day. A numeric string '1' will be converted to
'000001' this way. The new id is a string variable.
The variable 'safeid' may be handy to overcome 'bossy'
software; for instance Excel converts string vars that
look like numeric vars, even if you don't want this.
Your string var safeid is quoted.

numeric #x (n6.0).
compute #x = id.
string newid safeid (a6).
compute newid = string (id,n6.0).
compute safeid = concat ("'",newid,"'").
exe.

--- Dennis Deck <[hidden email]> wrote:

> Some options are:
>  a) add a constant (eg 100 or 1000) so all IDs have
> same number of
> digits (99 becomes 199 or 1099)
>  b) convert to a string and add a leading '0' if
> <100
>
> I don't remember if HLM cares whether the ID is
> numeric or string .
>
> Dennis Deck
>
> -----Original Message-----
> From: Judith Saebel
> [mailto:[hidden email]]
> Sent: Wednesday, September 12, 2007 1:32 AM
> Subject: Uniform data width for the ID variable?
>
> Dear All,
>
> I've been asked to adjust a .sav file to be used in
> HLM (6.04) so that
> the data in the ID variable have a uniform width.
> For example, if the
> largest value is 300, then anything smaller than 100
> has to start with a
> 0 (099, 078, etc.) or two zeroes (001, 005, etc.).
> I was told that this
> is a better way to set up the data file(s), before
> importing them into
> HLM.
>
> I've never head of this so I'd appreciate your
> views.
>
> Many thanks in advance,
>
> Judith Saebel
>
> -------------------------- Multilevel list
> --------------------------
> To leave, send    leave multilevel    to
> [hidden email]
> For further info about the Multilevel list, please
> see
> http://www.jiscmail.ac.uk/lists/multilevel.html
> and
>
http://www.nursing.teaching.man.ac.uk/staff/mcampbell/multilevel.html
>


Cheers!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


      ____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!   http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7