|
Dear all,
I want to list the values of one or several variables in the output under some conditions. E.g. do if LOS_day <= 0. Print / AdmissionDate2 DischargeDate2 . end if. But the syntax does not work. Could anyone help? Many thanks, Haiyan -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Peck, Jon Sent: 10 June 2008 22:19 To: [hidden email] Subject: Re: Question: OMS with Crosstabs There might be another way to do this, but here's one approach assuming that there are 4 y variables and one x variable. First, OMS is used to pick out the crosstab tables and create a new dataset that is then activated. Some useless variables are deleted along with the totals row, and finally a data restructure to put both rows of y values into a single case is carried out. The variable names indicate which columns are which. dataset declare xtab. oms select tables /if subtypes='Crosstabulation'/destination format=sav outfile=xtab /columns sequence=rall. CROSSTABS /TABLES=x1 BY y1 y2 y3 y4. omsend. dataset activate xtab. delete variables command_ subtype_ Label_ Var3 Total. select if var1 <> "Total". casestovars /id=var1 /groupby = var2. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Matthew Reeder Sent: Monday, June 09, 2008 4:55 PM To: [hidden email] Subject: [SPSSX-L] Question: OMS with Crosstabs Hey list, I'm converting output data (crosstabs) into SPSS datafiles for additional analysis using OMS. Each is a 2x2 crosstab (2 binary variables), where one of the variables (x1) is the same from one crosstabulation to the next, while the second variable in each crosstab is always different (y1, y2, y3, . . ., yk). So, the first crosstab would be x1 against y1, the second x1 against y2, and so on. x1 takes on the levels of 'low' and 'high,' while each of the y variables takes on the values of 0 or 1. The resultant datafile that I'm creating would ideally be structured such that each of the k y-variables from the original dataset will correspond to a row (k rows altogether). Each row would contain 4 variables corresponding to the crosstabulation results based on that variable (since x and the y-variables are dichotomous, the variables in the resultant dataset would represent counts for each of Low-0, Low-1, High-0, High-1, respectively). So, the row corresponding to say, y1, would contain variables corresponding to the values of y1 being crosstabbed against x1, and so on and so forth up through yk. Simple enough. Here's the problem: Ideally, I would like to have the dataset contain only 4 variables for all of the crosstabulation results. However, given how OMS creates variable names when creating the new datafile, the results from each crosstabulation are used to create a new set of 4 variables (an example below). So, instead of there being 4 columns in the new dataset, I wind up with 4*k columns. @.00_Low_Count @.00_High_Count @1.00_Low_Count @1.00_High_Count @.00_Low_Count_A @.00_High_Count_A @1.00_Low_Count_A @1.00_High_Count_A The structure of the dataset is at least somewhat correct (based on running the OMS with 'All dimensions in a single row' set). The only problem is that it's creating additional variables for each successive crosstab. Is there a clean way to get around this? Admittedly, I'm not too familiar with OMS aside from stuff I did a while back, so my apologies if this is a rather simplistic question. I referred to the OMS chapter in the user's manual; no dice. I tried playing around a bit with options under Utilities --> OMS Control Panel --> Options. Not much came about from that, either. Thanks in advance, Matt ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ------------------------------------------------------------------------ This email is confidential and is intended solely for the person or Entity to whom it is addressed. If this is not you, please forward the Message to [hidden email]. We have scanned this email before sending it, but cannot guarantee that malicious software is absent and we shall carry no liability in this regard. We advise that information intended to be kept confidential should not Be sent by email. We also advise that health concerns should be Discussed with a medical professional in person or by telephone. NHS Direct can also provide advice. We shall not be liable for any failure to follow this advice. University College London Hospitals NHS Foundation Trust (UCLH). ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Hi Haiyan,
What about: Temp. select if LOS_day <= 0. Print / AdmissionDate2 DischargeDate2 . Execute. HTH Jan -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Haiyan Gao Sent: Wednesday, June 11, 2008 1:37 PM To: [hidden email] Subject: Question: print or list in if condition Dear all, I want to list the values of one or several variables in the output under some conditions. E.g. do if LOS_day <= 0. Print / AdmissionDate2 DischargeDate2 . end if. But the syntax does not work. Could anyone help? Many thanks, Haiyan -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Peck, Jon Sent: 10 June 2008 22:19 To: [hidden email] Subject: Re: Question: OMS with Crosstabs There might be another way to do this, but here's one approach assuming that there are 4 y variables and one x variable. First, OMS is used to pick out the crosstab tables and create a new dataset that is then activated. Some useless variables are deleted along with the totals row, and finally a data restructure to put both rows of y values into a single case is carried out. The variable names indicate which columns are which. dataset declare xtab. oms select tables /if subtypes='Crosstabulation'/destination format=sav outfile=xtab /columns sequence=rall. CROSSTABS /TABLES=x1 BY y1 y2 y3 y4. omsend. dataset activate xtab. delete variables command_ subtype_ Label_ Var3 Total. select if var1 <> "Total". casestovars /id=var1 /groupby = var2. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Matthew Reeder Sent: Monday, June 09, 2008 4:55 PM To: [hidden email] Subject: [SPSSX-L] Question: OMS with Crosstabs Hey list, I'm converting output data (crosstabs) into SPSS datafiles for additional analysis using OMS. Each is a 2x2 crosstab (2 binary variables), where one of the variables (x1) is the same from one crosstabulation to the next, while the second variable in each crosstab is always different (y1, y2, y3, . . ., yk). So, the first crosstab would be x1 against y1, the second x1 against y2, and so on. x1 takes on the levels of 'low' and 'high,' while each of the y variables takes on the values of 0 or 1. The resultant datafile that I'm creating would ideally be structured such that each of the k y-variables from the original dataset will correspond to a row (k rows altogether). Each row would contain 4 variables corresponding to the crosstabulation results based on that variable (since x and the y-variables are dichotomous, the variables in the resultant dataset would represent counts for each of Low-0, Low-1, High-0, High-1, respectively). So, the row corresponding to say, y1, would contain variables corresponding to the values of y1 being crosstabbed against x1, and so on and so forth up through yk. Simple enough. Here's the problem: Ideally, I would like to have the dataset contain only 4 variables for all of the crosstabulation results. However, given how OMS creates variable names when creating the new datafile, the results from each crosstabulation are used to create a new set of 4 variables (an example below). So, instead of there being 4 columns in the new dataset, I wind up with 4*k columns. @.00_Low_Count @.00_High_Count @1.00_Low_Count @1.00_High_Count @.00_Low_Count_A @.00_High_Count_A @1.00_Low_Count_A @1.00_High_Count_A The structure of the dataset is at least somewhat correct (based on running the OMS with 'All dimensions in a single row' set). The only problem is that it's creating additional variables for each successive crosstab. Is there a clean way to get around this? Admittedly, I'm not too familiar with OMS aside from stuff I did a while back, so my apologies if this is a rather simplistic question. I referred to the OMS chapter in the user's manual; no dice. I tried playing around a bit with options under Utilities --> OMS Control Panel --> Options. Not much came about from that, either. Thanks in advance, Matt ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ------------------------------------------------------------------------ This email is confidential and is intended solely for the person or Entity to whom it is addressed. If this is not you, please forward the Message to [hidden email]. We have scanned this email before sending it, but cannot guarantee that malicious software is absent and we shall carry no liability in this regard. We advise that information intended to be kept confidential should not Be sent by email. We also advise that health concerns should be Discussed with a medical professional in person or by telephone. NHS Direct can also provide advice. We shall not be liable for any failure to follow this advice. University College London Hospitals NHS Foundation Trust (UCLH). ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD _____________ Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem. Jste si jisti, že opravdu potřebujete vytisknout tuto zprávu a/nebo její přílohy? Myslete na přírodu. This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission. Are you sure that you really need a print version of this message and/or its attachments? Think about nature. -.- -- ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Haiyan.Gao
At 07:37 AM 6/11/2008, Haiyan Gao wrote:
>I want to list the values of one or several variables in the output >under some conditions. E.g. > >do if LOS_day <= 0. >Print / AdmissionDate2 DischargeDate2 . >end if. > >But the syntax does not work. Could anyone help? You've seen Jan Spousta's response; that may well solve it for you. Otherwise, it's very hard to help when you tell us only that "the syntax does not work". If it gives an error message, what error message? If there's no error message, but you're not getting what you wanted, what did you want, and what did you get instead? However, one quick hint: you have one of the few cases where an EXECUTE is needed after the syntax. Or, expanding on Jan Spousta's answer, you might prefer the listing format you get with TEMPORARY. SELECT IF LOS_day <= 0. LIST VARIABLES=AdmissionDate2 DischargeDate2. -Good luck, Richard ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Haiyan.Gao
Dear Jan and Richard,
Many thanks for your prompt helpful replies. My problem has been solved. Haiyan -----Original Message----- From: Richard Ristow [mailto:[hidden email]] Sent: 11 June 2008 20:25 To: Gao,Haiyan; [hidden email] Cc: Spousta Jan Subject: Re: Question: print or list in if condition At 07:37 AM 6/11/2008, Haiyan Gao wrote: >I want to list the values of one or several variables in the output >under some conditions. E.g. > >do if LOS_day <= 0. >Print / AdmissionDate2 DischargeDate2 . >end if. > >But the syntax does not work. Could anyone help? You've seen Jan Spousta's response; that may well solve it for you. Otherwise, it's very hard to help when you tell us only that "the syntax does not work". If it gives an error message, what error message? If there's no error message, but you're not getting what you wanted, what did you want, and what did you get instead? However, one quick hint: you have one of the few cases where an EXECUTE is needed after the syntax. Or, expanding on Jan Spousta's answer, you might prefer the listing format you get with TEMPORARY. SELECT IF LOS_day <= 0. LIST VARIABLES=AdmissionDate2 DischargeDate2. -Good luck, Richard ------------------------------------------------------------------------ This email is confidential and is intended solely for the person or Entity to whom it is addressed. If this is not you, please forward the Message to [hidden email]. We have scanned this email before sending it, but cannot guarantee that malicious software is absent and we shall carry no liability in this regard. We advise that information intended to be kept confidential should not Be sent by email. We also advise that health concerns should be Discussed with a medical professional in person or by telephone. NHS Direct can also provide advice. We shall not be liable for any failure to follow this advice. University College London Hospitals NHS Foundation Trust (UCLH). ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
