|
CORRECTED
Greetings, Would someone tell me how to do an absolute value in SPSS ON A STRING. I have a set of numbers that I have imported numbers that have an embedded comma. Spss makes them missing as a numeric. 2,155.00 2,155.00 1,080.00 1,830.00 1,030.00 2,155.00 1,130.00 Thanks ===================== 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 |
|
Barbara,
>>Greetings, Would someone tell me how to do an absolute value in SPSS ON A STRING. I have a set of numbers that I have imported numbers that have an embedded comma. Spss makes them missing as a numeric. 2,155.00 2,155.00 1,080.00 1,830.00 1,030.00 2,155.00 1,130.00 It seems like you have two problems. One is how to read numeric values with embedded commas. Look at numeric formats in the syntax ref. Specifically: COMMA. Numeric values with a comma used as the grouping separator and a period used as decimal indicator. For example, 1,234.56. The second problem is the absolute value problem. I hope you know that the absolute value of a string is meaningless and that you really mean the absolute value of a numeric value. Look at the ABS function in the syntax ref. ABS. ABS(numexpr). Numeric. Returns the absolute value of numexpr, which must be numeric. Gene Maguin ===================== 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 Lombardo, Barbara
Try this.
data list list /mystring (A8). begin data '2,155.00' '2,155.00' '1,080.00' '1,830.00' '1,030.00' '2,155.00' '1,130.00' '-2,155.00' '-2,155.00' '-1,080.00' '-1,830.00' '-1,030.00' '-2,155.00' '-1,130.00' end data. compute myvar = number(mystring,comma8.2). compute myabsvar= abs(myvar). LIST . Art Kendall Social Research Consultants Lombardo, Barbara wrote: > CORRECTED > > > Greetings, Would someone tell me how to do an absolute value in SPSS ON > A STRING. I have a set of numbers that I have imported numbers that > have an embedded comma. Spss makes them missing as a numeric. > > 2,155.00 > 2,155.00 > 1,080.00 > 1,830.00 > 1,030.00 > 2,155.00 > 1,130.00 > > Thanks > > ===================== > 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
Art Kendall
Social Research Consultants |
|
In reply to this post by Lombardo, Barbara
Can you import the numbers with the appropriate format?
For example, this works: DATA LIST FREE (" ")/number (COMMA4.2). BEGIN DATA 2,155.00 2,155.00 1,080.00 1,830.00 1,030.00 2,155.00 1,130.00 END DATA . works. (Note that the delimiter has to be specified in order to prevent commas from being read as delimiters.) If you have a file with your sample data, this also works: GET DATA /TYPE = TXT /FILE = 'C:\Documents and Settings\jmarks\Desktop\nbrsample.txt' /DELCASE = LINE /DELIMITERS = "" /ARRANGEMENT = DELIMITED /FIRSTCASE = 1 /IMPORTCASE = ALL /VARIABLES = V1 COMMA4.2 . I generated this via the Text Import Wizard, but I had to edit the format for V1 to COMMA4.2 (The GUI preferred COMMA1.0-- not sure why.) --jim -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombardo, Barbara Sent: Tuesday, December 16, 2008 2:57 PM To: [hidden email] Subject: FW: Absolute value OF STRING CORRECTED Greetings, Would someone tell me how to do an absolute value in SPSS ON A STRING. I have a set of numbers that I have imported numbers that have an embedded comma. Spss makes them missing as a numeric. 2,155.00 2,155.00 1,080.00 1,830.00 1,030.00 2,155.00 1,130.00 Thanks ===================== 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 |
|
In reply to this post by Lombardo, Barbara
Hi!
See below. Cheers!! Albert-Jan * sample data. data list free / in (a8). begin data '2,155.00' '1,080.00' end data. * actual code. set locale 'us'. /* might not be necessary. compute out = number (in, comma10). --- On Tue, 12/16/08, Lombardo, Barbara <[hidden email]> wrote: > From: Lombardo, Barbara <[hidden email]> > Subject: FW: Absolute value OF STRING > To: [hidden email] > Date: Tuesday, December 16, 2008, 9:57 PM > CORRECTED > > > Greetings, Would someone tell me how to do an absolute > value in SPSS ON > A STRING. I have a set of numbers that I have imported > numbers that > have an embedded comma. Spss makes them missing as a > numeric. > > 2,155.00 > 2,155.00 > 1,080.00 > 1,830.00 > 1,030.00 > 2,155.00 > 1,130.00 > > Thanks > > ===================== > 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 |
|
Setting the locale should not be necessary, since comma format is locale-invariant. If SET LOCALE were necessary, it would have to come before you even read the data source, since you can't change the locale when there are any open data sources.
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Albert-jan Roskam Sent: Wednesday, December 17, 2008 4:40 AM To: [hidden email] Subject: Re: FW: Absolute value OF STRING Hi! See below. Cheers!! Albert-Jan * sample data. data list free / in (a8). begin data '2,155.00' '1,080.00' end data. * actual code. set locale 'us'. /* might not be necessary. compute out = number (in, comma10). --- On Tue, 12/16/08, Lombardo, Barbara <[hidden email]> wrote: > From: Lombardo, Barbara <[hidden email]> > Subject: FW: Absolute value OF STRING > To: [hidden email] > Date: Tuesday, December 16, 2008, 9:57 PM > CORRECTED > > > Greetings, Would someone tell me how to do an absolute > value in SPSS ON > A STRING. I have a set of numbers that I have imported > numbers that > have an embedded comma. Spss makes them missing as a > numeric. > > 2,155.00 > 2,155.00 > 1,080.00 > 1,830.00 > 1,030.00 > 2,155.00 > 1,130.00 > > Thanks > > ===================== > 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 ===================== 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 |
|
Hello,
Can someone please tell me the name of the function to see if a date falls between the range of two other dates? Thank you ===================== 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 |
|
Barbara,
I am pretty sure there is not a specific function. But, and remembering that dates are stored as the number of seconds since a specific date, an If statement would do what you want. Gene Maguin >>Can someone please tell me the name of the function to see if a date falls between the range of two other dates? ===================== 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 |
|
Use the date function to test for specific dates. For example,
If datevar ge date.mdy(1,1,2009) and datevar lt date.mdy(4,1,2009) quarternumber=1. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gene Maguin Sent: Thursday, January 22, 2009 7:29 AM To: [hidden email] Subject: Re: date range function Barbara, I am pretty sure there is not a specific function. But, and remembering that dates are stored as the number of seconds since a specific date, an If statement would do what you want. Gene Maguin >>Can someone please tell me the name of the function to see if a date falls between the range of two other dates? ===================== 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 |
|
In reply to this post by Lombardo, Barbara
open a new instance of SPSS. copy the syntax below into a syntax window.
Run it. does this do what you want? DATA LIST list/mydate(adate10). BEGIN DATA 1/1/2009 1/2/2009 1/1/1955 5/6/1963 7/8/1967 9/10/1977 11/20/2009 end data. COMPUTE inrange=range(mydate,DATE.MDY(1,1,1960),DATE.MDY(2,1,2009)). formats inrange (f1). value labels inrange 0 'no' 1 'yes'. list. Art Kendall Social Research Consultants Lombardo, Barbara wrote: > Hello, > > Can someone please tell me the name of the function to see if a date > falls between the range of two other dates? > > Thank you > > ===================== > 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 |
|
In reply to this post by ViAnn Beadle
Hello, I'm using SPSS release 17 and just found that I can no longer
Cut and paste a column. Does anyone know how to get around this? Thanks Barbara ===================== 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 |
|
Are you talking about a column in the data editor? Where are pasting to?
I can cut a column in the data editor and paste after the last variable column. What is your goal with this operation? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombardo, Barbara Sent: Wednesday, April 15, 2009 3:27 PM To: [hidden email] Subject: CUT AND PASTE Hello, I'm using SPSS release 17 and just found that I can no longer Cut and paste a column. Does anyone know how to get around this? Thanks Barbara ===================== 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 |
|
I want to be able to cut a column and paste it over an existing column,
or place my last column in between two existing columns. Same as rel 15 and Excel allow you to do. This is a major inconvenience to me. To get around a simple cut and paste I had to use a compute to move the column. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ViAnn Beadle Sent: Wednesday, April 15, 2009 5:57 PM To: [hidden email] Subject: Re: CUT AND PASTE Are you talking about a column in the data editor? Where are pasting to? I can cut a column in the data editor and paste after the last variable column. What is your goal with this operation? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombardo, Barbara Sent: Wednesday, April 15, 2009 3:27 PM To: [hidden email] Subject: CUT AND PASTE Hello, I'm using SPSS release 17 and just found that I can no longer Cut and paste a column. Does anyone know how to get around this? Thanks Barbara ===================== 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 ===================== 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 |
|
Why don't you use drag and drop instead of copy/paste? It works in variable view as well as in data view.
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombrdo, Barbara Sent: Thursday, April 16, 2009 3:11 PM To: [hidden email] Subject: Re: CUT AND PASTE I want to be able to cut a column and paste it over an existing column, or place my last column in between two existing columns. Same as rel 15 and Excel allow you to do. This is a major inconvenience to me. To get around a simple cut and paste I had to use a compute to move the column. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ViAnn Beadle Sent: Wednesday, April 15, 2009 5:57 PM To: [hidden email] Subject: Re: CUT AND PASTE Are you talking about a column in the data editor? Where are pasting to? I can cut a column in the data editor and paste after the last variable column. What is your goal with this operation? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombardo, Barbara Sent: Wednesday, April 15, 2009 3:27 PM To: [hidden email] Subject: CUT AND PASTE Hello, I'm using SPSS release 17 and just found that I can no longer Cut and paste a column. Does anyone know how to get around this? Thanks Barbara ===================== 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 ===================== 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 |
|
Hi everybody,
Who has experience with using SPSS from VBA and MS Access. How do I set the Data Source property? Thank you, Max ===================== 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 Lombardo, Barbara
I have no problems doing that in 17. Select the entire column and cut it.
Select the replacement column and paste it. To insert a cut column, use variable view to cut a row, select a row and use the right button context menu to insert the row(s). BTW, it's much easier to do these kinds of things in variable view because you don't get all the screen updating that happens in data view. -----Original Message----- From: Lombardo, Barbara [mailto:[hidden email]] Sent: Thursday, April 16, 2009 6:11 AM To: ViAnn Beadle; [hidden email] Subject: RE: Re: CUT AND PASTE I want to be able to cut a column and paste it over an existing column, or place my last column in between two existing columns. Same as rel 15 and Excel allow you to do. This is a major inconvenience to me. To get around a simple cut and paste I had to use a compute to move the column. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ViAnn Beadle Sent: Wednesday, April 15, 2009 5:57 PM To: [hidden email] Subject: Re: CUT AND PASTE Are you talking about a column in the data editor? Where are pasting to? I can cut a column in the data editor and paste after the last variable column. What is your goal with this operation? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombardo, Barbara Sent: Wednesday, April 15, 2009 3:27 PM To: [hidden email] Subject: CUT AND PASTE Hello, I'm using SPSS release 17 and just found that I can no longer Cut and paste a column. Does anyone know how to get around this? Thanks Barbara ===================== 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 ===================== 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 Mārtiņš Vanags
The "drag-and-drop" function for variables has been crippled in v17 unfortunately. I was previously able to move a variable from the end to the beginning of a 1,000 variable file in approx 5 seconds. That now takes approx 90 seconds.
I asked SPSS about a way to move variables around using syntax, and here was their recommendation: Suppose you have a file with 30 variables (var1 to var30) and you want to move var23 in between var8 and var9. MATCH FILES FILE=* /keep var1 to var8 var23 var9 to var22 var24 to var30 This does work, but I feel it is only helpful in HIGHLY specialized circumstances. SPSS 17 has a known issue that windows shortcuts (CTRL-C or DELETE) sometimes stop working after a while. SPSS 16 had the same problem and it was fixed with patch 16.0.2 (http://support.spss.com/ProductsExt/SPSS/Patches/SPSS%20Server/16.0.2/16.0.2_Description.html) issue 71. So, if you're trying to cut and paste by just using the shortcut keys, that might be the problem. If you are instead talking about cutting and pasting a column of variable names, for example using Excel to tweak the variable names by adding a suffix or prefix (Dist_Band changed to DistanceBand or HIST changed to Major_HIST). SPSS does not seem to like having variable names pasted from Excel anymore. The workaround that I have used is to copy the list of variable names and paste them into a syntax window and Excel. After I've manipulated the variable names in Excel, I paste the new variables names into the syntax window. So it looks like this: RENAME VARIABLES (old var 1 Old var 2 ... Old var 25= New var 1 New var2 ... New var 25). Hope that helps, -Eric -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Martinš Vanags Sent: Thursday, April 16, 2009 7:17 AM To: [hidden email] Subject: Re: CUT AND PASTE Why don't you use drag and drop instead of copy/paste? It works in variable view as well as in data view. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombrdo, Barbara Sent: Thursday, April 16, 2009 3:11 PM To: [hidden email] Subject: Re: CUT AND PASTE I want to be able to cut a column and paste it over an existing column, or place my last column in between two existing columns. Same as rel 15 and Excel allow you to do. This is a major inconvenience to me. To get around a simple cut and paste I had to use a compute to move the column. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ViAnn Beadle Sent: Wednesday, April 15, 2009 5:57 PM To: [hidden email] Subject: Re: CUT AND PASTE Are you talking about a column in the data editor? Where are pasting to? I can cut a column in the data editor and paste after the last variable column. What is your goal with this operation? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombardo, Barbara Sent: Wednesday, April 15, 2009 3:27 PM To: [hidden email] Subject: CUT AND PASTE Hello, I'm using SPSS release 17 and just found that I can no longer Cut and paste a column. Does anyone know how to get around this? Thanks Barbara ===================== 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 ===================== 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 ===================== 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 |
