CasesToVars problem

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

CasesToVars problem

Cleland, Patricia (EDU)

I have a data set that contains treatment data on just under 5000 agencies, located in 72 counties.  Each agency is either a Level1 or Level2 agency. No agency is in more than one county. Each agency is a record.

 

In addition to the agency and county identifiers, the data consists of:

-# of clients who were referred to the program;

-#and % of clients who: attended, completed, did not attend, were still in treatment on the date that the data was downloaded

 

 

Through AGGREGATE and MERGE, I have created a data set with 144 lines (one per county per level, plus one for ‘all counties’ per level) with the variables as above. Now I want to restructure the data so that I have only one line for each county, plus the ‘all counties’ data.

 

Here’s the syntax I’m using:

 

CASESTOVARS

  /ID=CountyNumber

  /INDEX=Level

  /GROUPBY=INDEX.

 

I expected to get the variables above with the suffix Level1 or Level2, but for 2 variables (Num_Attended PC_Attended, that is number and % who attended) this didn’t happen. The list of Generated Variables does not include these variables, and there is no error message as to why not.   I’ve tried deleting all created data files and rerunning from the raw data set and that didn’t fix the problem. 

 

Any suggestions would be appreciated.

 

Why is it that computers always know when you’re trying to get something finished before the weekend?

 

 

 

Pat

Reply | Threaded
Open this post in threaded view
|

Re: CasesToVars problem

Maguin, Eugene

Pat,

The short answer is that I don’t know but, and first of all, were those two variables there coming out of the aggregate? If yes, and as unlikely as it might be, could those two variables have constant values over all records? If so, neither would have a .1/.2 extension to the variable name. Or, could those two variables be missing for all records? I think the default is to drop variables with missing/blank values for all records. Check the syntax reference on this point.

 

Gene Maguin

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Cleland, Patricia (EDU)
Sent: Friday, February 10, 2012 2:01 PM
To: [hidden email]
Subject: CasesToVars problem

 

I have a data set that contains treatment data on just under 5000 agencies, located in 72 counties.  Each agency is either a Level1 or Level2 agency. No agency is in more than one county. Each agency is a record.

 

In addition to the agency and county identifiers, the data consists of:

-# of clients who were referred to the program;

-#and % of clients who: attended, completed, did not attend, were still in treatment on the date that the data was downloaded

 

 

Through AGGREGATE and MERGE, I have created a data set with 144 lines (one per county per level, plus one for ‘all counties’ per level) with the variables as above. Now I want to restructure the data so that I have only one line for each county, plus the ‘all counties’ data.

 

Here’s the syntax I’m using:

 

CASESTOVARS

  /ID=CountyNumber

  /INDEX=Level

  /GROUPBY=INDEX.

 

I expected to get the variables above with the suffix Level1 or Level2, but for 2 variables (Num_Attended PC_Attended, that is number and % who attended) this didn’t happen. The list of Generated Variables does not include these variables, and there is no error message as to why not.   I’ve tried deleting all created data files and rerunning from the raw data set and that didn’t fix the problem. 

 

Any suggestions would be appreciated.

 

Why is it that computers always know when you’re trying to get something finished before the weekend?

 

 

 

Pat

Reply | Threaded
Open this post in threaded view
|

Re: CasesToVars problem

Bruce Weaver
Administrator
In reply to this post by Cleland, Patricia (EDU)
It would help if you provided a few cases from your data file that illustrate the problem--this would allow other folks to try it.  You could generate them via LIST.  E.g.,

TEMPORARY.
SELECT IF $casenum LE 15.
LIST.

If there are a LOT of variables, you could list only some of the variables needed to illustrate the problem:

LIST <list of selected variables here>.

HTH.


Cleland, Patricia (EDU) wrote
I have a data set that contains treatment data on just under 5000
agencies, located in 72 counties.  Each agency is either a Level1 or
Level2 agency. No agency is in more than one county. Each agency is a
record.

 

In addition to the agency and county identifiers, the data consists of:

-# of clients who were referred to the program;

-#and % of clients who: attended, completed, did not attend, were still
in treatment on the date that the data was downloaded

 

 

Through AGGREGATE and MERGE, I have created a data set with 144 lines
(one per county per level, plus one for 'all counties' per level) with
the variables as above. Now I want to restructure the data so that I
have only one line for each county, plus the 'all counties' data.

 

Here's the syntax I'm using:

 

CASESTOVARS

  /ID=CountyNumber

  /INDEX=Level

  /GROUPBY=INDEX.

 

I expected to get the variables above with the suffix Level1 or Level2,
but for 2 variables (Num_Attended PC_Attended, that is number and % who
attended) this didn't happen. The list of Generated Variables does not
include these variables, and there is no error message as to why not.
I've tried deleting all created data files and rerunning from the raw
data set and that didn't fix the problem.  

 

Any suggestions would be appreciated.

 

Why is it that computers always know when you're trying to get something
finished before the weekend?

 

 

 

Pat
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: CasesToVars problem

David Marso
Administrator
Both a data snippet and an example of corresponding desired output would be useful in our providing assistance.
Bruce Weaver wrote
It would help if you provided a few cases from your data file that illustrate the problem--this would allow other folks to try it.  You could generate them via LIST.  E.g.,

TEMPORARY.
SELECT IF $casenum LE 15.
LIST.

If there are a LOT of variables, you could list only some of the variables needed to illustrate the problem:

LIST <list of selected variables here>.

HTH.


Cleland, Patricia (EDU) wrote
I have a data set that contains treatment data on just under 5000
agencies, located in 72 counties.  Each agency is either a Level1 or
Level2 agency. No agency is in more than one county. Each agency is a
record.

 

In addition to the agency and county identifiers, the data consists of:

-# of clients who were referred to the program;

-#and % of clients who: attended, completed, did not attend, were still
in treatment on the date that the data was downloaded

 

 

Through AGGREGATE and MERGE, I have created a data set with 144 lines
(one per county per level, plus one for 'all counties' per level) with
the variables as above. Now I want to restructure the data so that I
have only one line for each county, plus the 'all counties' data.

 

Here's the syntax I'm using:

 

CASESTOVARS

  /ID=CountyNumber

  /INDEX=Level

  /GROUPBY=INDEX.

 

I expected to get the variables above with the suffix Level1 or Level2,
but for 2 variables (Num_Attended PC_Attended, that is number and % who
attended) this didn't happen. The list of Generated Variables does not
include these variables, and there is no error message as to why not.
I've tried deleting all created data files and rerunning from the raw
data set and that didn't fix the problem.  

 

Any suggestions would be appreciated.

 

Why is it that computers always know when you're trying to get something
finished before the weekend?

 

 

 

Pat
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: CasesToVars problem

Cleland, Patricia (EDU)
In reply to this post by Maguin, Eugene

Thanks, Gene.  That was exactly the problem. I never would have thought to check for that. When I went back and looked at the raw data, the value of Num_attend was 0 for all cases. (I now also know why that was the case.)  I’ve re-run the analysis from the top, excluding Num_attend in the AGGREGATE command and the data looks like it makes sense now.

 

Thanks, again.

 

Pat


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gene Maguin
Sent: February 10, 2012 2:22 PM
To: [hidden email]
Subject: Re: [SPSSX-L] CasesToVars problem

 

Pat,

The short answer is that I don’t know but, and first of all, were those two variables there coming out of the aggregate? If yes, and as unlikely as it might be, could those two variables have constant values over all records? If so, neither would have a .1/.2 extension to the variable name. Or, could those two variables be missing for all records? I think the default is to drop variables with missing/blank values for all records. Check the syntax reference on this point.

 

Gene Maguin

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Cleland, Patricia (EDU)
Sent: Friday, February 10, 2012 2:01 PM
To: [hidden email]
Subject: CasesToVars problem

 

I have a data set that contains treatment data on just under 5000 agencies, located in 72 counties.  Each agency is either a Level1 or Level2 agency. No agency is in more than one county. Each agency is a record.

 

In addition to the agency and county identifiers, the data consists of:

-# of clients who were referred to the program;

-#and % of clients who: attended, completed, did not attend, were still in treatment on the date that the data was downloaded

 

 

Through AGGREGATE and MERGE, I have created a data set with 144 lines (one per county per level, plus one for ‘all counties’ per level) with the variables as above. Now I want to restructure the data so that I have only one line for each county, plus the ‘all counties’ data.

 

Here’s the syntax I’m using:

 

CASESTOVARS

  /ID=CountyNumber

  /INDEX=Level

  /GROUPBY=INDEX.

 

I expected to get the variables above with the suffix Level1 or Level2, but for 2 variables (Num_Attended PC_Attended, that is number and % who attended) this didn’t happen. The list of Generated Variables does not include these variables, and there is no error message as to why not.   I’ve tried deleting all created data files and rerunning from the raw data set and that didn’t fix the problem. 

 

Any suggestions would be appreciated.

 

Why is it that computers always know when you’re trying to get something finished before the weekend?

 

 

 

Pat