help with simplifying aggregate function

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

help with simplifying aggregate function

thara vardhan-2
Dear List members

I would be really thankful if anyone could help me simplify the process of
creating the sum of responses using aggregate function.

From a survey conducted by an independent organisation for a question on
confidences in the services provided by us:
the survey has provided 4 responses as 1- disagree 2- agree 3 - neither
and 9 - don'tknow

Since the responses are coded as 1,2, 3 or 9 I have to calculate the sum
of responses under each and analyse the data.

I tried using the aggregate function through the SPSS menu. While I am
able to calculate and create a separate data file for each response I was
unable to create one aggregate outfile file for all variables.

To overcoming this I have run the following syntax which is helpful

COMPUTE rq10dedisagree=rq10degroup = 1.
COMPUTE rq10deagree=rq10degroup = 2.
COMPUTE rq10deneither=rq10degroup = 3.
compute rq10dedontknow=rq10degroup=9.
exe.
AGGREGATE
  /OUTFILE='P:\Commissioners Inspectorate\ORS\Stats Team\Community
Attitudes'+
 ' Survey\spss files\comm survey agg files 3 qtrs 06-07\aggregate
confidence in'+
 ' police 070713.sav'
  /BREAK=POLREGX Region
  /rq10dedisagree_sum 'rq10dedisagree' = SUM(rq10dedisagree)
/rq10deagree_sum
  'rq10deagree' = SUM(rq10deagree) /rq10deneither_sum 'rq10deneither' =
  SUM(rq10deneither) /rq10dedontknow_sum = sum(rq10dedontknow).

Since I have many variables in my survey data file, Is there an easier way
to do this?

I would truly appreciate it if any member could help me with this.

looking forward to your reply.

thanks

regards
Thara Vardhan
Senior Statistician
Planning & Results
Organisation Review and Support
NSW Police
Tel: (02) 8835-8526


This message and any attachment is confidential and may
be privileged or otherwise protected from disclosure. If you
have received it by mistake, please let us know by reply
and then delete it from your system; you should not copy
the message or disclose its contents to anyone.
Reply | Threaded
Open this post in threaded view
|

Latin, ASCII, UTF-8... ?

Albert-Jan Roskam
Hi list,

I have a file which contains patient codes, but these
codes look 'weird', i.e. they contain ü,ï, german
ringel-S (looks a bit like a B), 1/4-signs, etc. etc.
I tried changing the display format to AHEX, and it
looks more 'normal', but I suspect there is a problem
with the font codec (if that's what it's called). The
data were originally exported from a database, then
imported to ours.

Is there some way I can change the coding system from
e.g. to Latin, ASCII, UTF-8 etc just to check when the
values look normal?

Thanks in advance!

Albert-Jan

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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
Reply | Threaded
Open this post in threaded view
|

Re: Latin, ASCII, UTF-8... ?

Peck, Jon
I assume that what you have is a text file you are reading.  The first thing you need to do is to determine what encoding the text is in.  Assuming that you are on Windows, it will almost surely  be in a Windows code page, in Unicode utf-16, or in utf-8.  One way to check is to open it in Notepad.  If it looks correct there, then look at the Encoding dropdown of the File Save dialog.  You will see ANSI (a misnomer that means a traditional Windows code page),  Unicode, Unicode-big-endian, or utf-8.

Now suppose it says ANSI.  Then you need to make sure that SPSS is in the same code page.  You can do that with the SET LOCALE command, but SPSS normally initializes to the code page of your Windows system.

If Notepad says some flavor of Unicode, then the current SPSS version cannot read the file in that encoding.  (SPSS 16 will deal with this.)  You can change it to ANSI in Notepad and save it under a different name, and all should be well.

Except that if some characters cannot be represented in the ANSI code page, they will be converted to "?".  So be sure to save the file under a different name.

There are other more esoteric possibilities, but I won't go into them unless the above does not solve the problem.  Also, if the file is too big for Notepad, you would need to convert it another way, but current Notepad isn't the baby it once was.

HTH,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Albert-jan Roskam
Sent: Friday, July 13, 2007 4:54 AM
To: [hidden email]
Subject: [SPSSX-L] Latin, ASCII, UTF-8... ?

Hi list,

I have a file which contains patient codes, but these
codes look 'weird', i.e. they contain ü,ï, german
ringel-S (looks a bit like a B), 1/4-signs, etc. etc.
I tried changing the display format to AHEX, and it
looks more 'normal', but I suspect there is a problem
with the font codec (if that's what it's called). The
data were originally exported from a database, then
imported to ours.

Is there some way I can change the coding system from
e.g. to Latin, ASCII, UTF-8 etc just to check when the
values look normal?

Thanks in advance!

Albert-Jan

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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
Reply | Threaded
Open this post in threaded view
|

Re: help with simplifying aggregate function

ViAnn Beadle
In reply to this post by thara vardhan-2
Look at the FREQUENCIES command. You can also use the menus to do this --
Analyze>Descriptive Statistics>Frequencies

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Thara Vardhan
Sent: Friday, July 13, 2007 12:52 AM
To: [hidden email]
Subject: help with simplifying aggregate function

Dear List members

I would be really thankful if anyone could help me simplify the process of
creating the sum of responses using aggregate function.

From a survey conducted by an independent organisation for a question on
confidences in the services provided by us:
the survey has provided 4 responses as 1- disagree 2- agree 3 - neither
and 9 - don'tknow

Since the responses are coded as 1,2, 3 or 9 I have to calculate the sum
of responses under each and analyse the data.

I tried using the aggregate function through the SPSS menu. While I am
able to calculate and create a separate data file for each response I was
unable to create one aggregate outfile file for all variables.

To overcoming this I have run the following syntax which is helpful

COMPUTE rq10dedisagree=rq10degroup = 1.
COMPUTE rq10deagree=rq10degroup = 2.
COMPUTE rq10deneither=rq10degroup = 3.
compute rq10dedontknow=rq10degroup=9.
exe.
AGGREGATE
  /OUTFILE='P:\Commissioners Inspectorate\ORS\Stats Team\Community
Attitudes'+
 ' Survey\spss files\comm survey agg files 3 qtrs 06-07\aggregate
confidence in'+
 ' police 070713.sav'
  /BREAK=POLREGX Region
  /rq10dedisagree_sum 'rq10dedisagree' = SUM(rq10dedisagree)
/rq10deagree_sum
  'rq10deagree' = SUM(rq10deagree) /rq10deneither_sum 'rq10deneither' =
  SUM(rq10deneither) /rq10dedontknow_sum = sum(rq10dedontknow).

Since I have many variables in my survey data file, Is there an easier way
to do this?

I would truly appreciate it if any member could help me with this.

looking forward to your reply.

thanks

regards
Thara Vardhan
Senior Statistician
Planning & Results
Organisation Review and Support
NSW Police
Tel: (02) 8835-8526


This message and any attachment is confidential and may
be privileged or otherwise protected from disclosure. If you
have received it by mistake, please let us know by reply
and then delete it from your system; you should not copy
the message or disclose its contents to anyone.
Reply | Threaded
Open this post in threaded view
|

Re: Latin, ASCII, UTF-8... ?

Albert-Jan Roskam
In reply to this post by Peck, Jon
Hi Jon,

Thanks for your kind reply.

I followed your advice:
**I pasted some weird-looking patient codes in
notepad. They were in ANSI coding. I saved them in all
other available codes (UTF8, Unicode, Unicode, Big
endian)
** I imported them in SPSS using Read Text Data, using
a test file with 7 records with identical patient
codes:
-UTF8 --> A code that was identical in the original
file, became two different codes in the UTF-coded
file. Scary!
-Unicode/ Unicode Big endian --> Only one of seven
test record could be imported, the other six records
were empty.

** Meanwhile, I tried using SET LOCALE 'US', and SET
LOCALE 'dutch'.

In all occasions, the codes still looked 'weird'.

Do you have any suggestions? Note that, superfluously,
the unicity of the codes is pivotal in this.

Thanks in advance,
Albert-Jan

PS, btw, I just started reading the Python tutorial.
You're right, it's great, the possibilities are
endless, and it's not that difficult at all!!


--- "Peck, Jon" <[hidden email]> wrote:

> I assume that what you have is a text file you are
> reading.  The first thing you need to do is to
> determine what encoding the text is in.  Assuming
> that you are on Windows, it will almost surely  be
> in a Windows code page, in Unicode utf-16, or in
> utf-8.  One way to check is to open it in Notepad.
> If it looks correct there, then look at the Encoding
> dropdown of the File Save dialog.  You will see ANSI
> (a misnomer that means a traditional Windows code
> page),  Unicode, Unicode-big-endian, or utf-8.
>
> Now suppose it says ANSI.  Then you need to make
> sure that SPSS is in the same code page.  You can do
> that with the SET LOCALE command, but SPSS normally
> initializes to the code page of your Windows system.
>
> If Notepad says some flavor of Unicode, then the
> current SPSS version cannot read the file in that
> encoding.  (SPSS 16 will deal with this.)  You can
> change it to ANSI in Notepad and save it under a
> different name, and all should be well.
>
> Except that if some characters cannot be represented
> in the ANSI code page, they will be converted to
> "?".  So be sure to save the file under a different
> name.
>
> There are other more esoteric possibilities, but I
> won't go into them unless the above does not solve
> the problem.  Also, if the file is too big for
> Notepad, you would need to convert it another way,
> but current Notepad isn't the baby it once was.
>
> HTH,
> Jon Peck
>
> -----Original Message-----
> From: SPSSX(r) Discussion
> [mailto:[hidden email]] On Behalf Of
> Albert-jan Roskam
> Sent: Friday, July 13, 2007 4:54 AM
> To: [hidden email]
> Subject: [SPSSX-L] Latin, ASCII, UTF-8... ?
>
> Hi list,
>
> I have a file which contains patient codes, but
> these
> codes look 'weird', i.e. they contain ü,ï, german
> ringel-S (looks a bit like a B), 1/4-signs, etc.
> etc.
> I tried changing the display format to AHEX, and it
> looks more 'normal', but I suspect there is a
> problem
> with the font codec (if that's what it's called).
> The
> data were originally exported from a database, then
> imported to ours.
>
> Is there some way I can change the coding system
> from
> e.g. to Latin, ASCII, UTF-8 etc just to check when
> the
> values look normal?
>
> Thanks in advance!
>
> Albert-Jan
>
> 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]
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
____________________________________________________________________________________
> Be a better Globetrotter. Get better travel answers
> from someone who knows. Yahoo! Answers - Check it
> out.
>
http://answers.yahoo.com/dir/?link=list&sid=396545469
>


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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



____________________________________________________________________________________
Sick sense of humor? Visit Yahoo! TV's
Comedy with an Edge to see what's on, when.
http://tv.yahoo.com/collections/222