Looping with frequencies?

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

Looping with frequencies?

Lola Coker
I have data that is grouped by site ID.  I need to run frequencies based
on each site ID. How can I do this?  (I'm guessing some sort of loop?)

Help would be greatly appreciated!
Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Looping with frequencies?

Beadle, ViAnn
Look at SPLIT FILE.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lola Coker
Sent: Monday, May 14, 2007 1:22 PM
To: [hidden email]
Subject: Looping with frequencies?

I have data that is grouped by site ID.  I need to run frequencies based
on each site ID. How can I do this?  (I'm guessing some sort of loop?)

Help would be greatly appreciated!
Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Looping with frequencies?

Lola Coker
In reply to this post by Lola Coker
Thank you so much for your reply

Split file works except I also have some other commands I need to run
along with frequencies--the outputs need to be saved in separate files and
exported to excel (via syntax).  I was hoping that I would be able to just
create a loop of some kind...

This is actually for a set of reports that have a deadline attached...I
really would appreciate any and all help (mercy) that anyone is willing to
give.

Thanks again,
Lola
Reply | Threaded
Open this post in threaded view
|

Re: Looping with frequencies?

Beadle, ViAnn
You'll have to provide many more details about what you really want to do to get any salient reply to the task at hand. Ask a simple question, get a simple answer.

Note that you most likely have to learn about OMS if you want to export output via syntax to anywhere.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lola Coker
Sent: Monday, May 14, 2007 9:26 PM
To: [hidden email]
Subject: [BULK] Re: Looping with frequencies?
Importance: Low

Thank you so much for your reply

Split file works except I also have some other commands I need to run
along with frequencies--the outputs need to be saved in separate files and
exported to excel (via syntax).  I was hoping that I would be able to just
create a loop of some kind...

This is actually for a set of reports that have a deadline attached...I
really would appreciate any and all help (mercy) that anyone is willing to
give.

Thanks again,
Lola
Reply | Threaded
Open this post in threaded view
|

Re: Looping with frequencies?

Bob Walker-2
In reply to this post by Lola Coker
Lola,

If you need to export to Excel, then you might want to try using AGGREGATE to crunch your frequency data. You can then easily export it to Excel. Otherwise you are stuck with cut and paste operations.

I'm assuming that you want to have a spreadsheet a unique SiteID in each row (with the SiteID in the first column and then your frequency data as variables in adjacent columns). Here's one approach using a simple macro to loop through three variables (using test data)...
DATA LIST FREE / SITEID V1 TO V3.
BEGIN DATA
123 2 3 2
123 2 1 2
123 2 2 2
321 3 1 3
321 2 2 2
321 3 3 2
456 2 1 2
456 1 2 1
456 3 3 3
END DATA.
DEFINE !LOLA (VLIST=!ENCLOSE("[","]"))
AGG OUT=* / BREAK SITEID
!DO !Z !IN (!VLIST)
!CONCAT("/",!Z,"_Mean") = MEAN (!Z)
!CONCAT("/",!Z,"_Median") = MEDIAN (!Z)
!CONCAT("/",!Z,"_Min") = MIN (!Z)
!CONCAT("/",!Z,"_Max") = MAX (!Z)
!CONCAT("/",!Z,"_StdDev") = SD (!Z)
!CONCAT("/",!Z,"_Sum") = SUM (!Z)
!DOEND.

DATASET NAME EXAMPLE WINDOW=FRONT.

!ENDDEFINE.
!LOLA VLIST [V1 V2 V3].

You are limited to the stats that AGG has available natively, but you can also create other stats you need first and then use AGG afterwards. HTH,
Bob Walker
Surveys & Forecasts, LLC
www.safllc.com


----- Original Message -----
From: Lola Coker
Date: Tuesday, May 15, 2007 9:50 am
Subject: Re: Looping with frequencies?
To: [hidden email]

> Thank you so much for your reply
>
> Split file works except I also have some other commands I need
> to run
> along with frequencies--the outputs need to be saved in separate
> files and
> exported to excel (via syntax). I was hoping that I would be
> able to just
> create a loop of some kind...
>
> This is actually for a set of reports that have a deadline
> attached...Ireally would appreciate any and all help (mercy)
> that anyone is willing to
> give.
>
> Thanks again,
> Lola
>

 Bob Walker
Surveys & Forecasts, LLC
www.safllc.com
Reply | Threaded
Open this post in threaded view
|

Re: Looping with frequencies?

Lola Coker
In reply to this post by Lola Coker
* forgot to mention, I don't have the SPSS Tables addon (I'm not sure the
department can afford it at this time)
Reply | Threaded
Open this post in threaded view
|

Re: Looping with frequencies?

Sarraf, Shimon Aaron
Just replace the ctables with your frequency command and make the
necessary adjustment within OMS--refer to the command syntax book.

Take care,

Shimon

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Lola C.
Sent: Tuesday, May 15, 2007 3:39 PM
To: [hidden email]
Subject: Re: Looping with frequencies?

* forgot to mention, I don't have the SPSS Tables addon (I'm not sure
the department can afford it at this time)