Hello,I have a file with inpatient care events for several persons. Some
of them have only one visit and others have more than one visit in the file. I want to create a syntax that selects only visits that come from new disease events. The first record in the file for a person is considered to be a new event, the next visit for that person is considered to be a new event if the first day of the visit (indate) is more than 28 days after the last date for the previous visit (outdate). Every visit for a person is checked in the same way; indate - previous outdate > 28 days. Do anybody know the answer to this problem? ===================== 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 |
Administrator
|
See COMPUTE, LAG, CTIME functions and IF commands in the manual.
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?" |
Administrator
|
COMPUTE GT28days=CTIME.DAYS(indate-LAG(outdate) ) GT 28.
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?" |
Hello and thank you David for showing me how to calculate with values on different rows. I used the aggregate function to get the sequence number for each event for each person. This was done to mark the first event for each person as new and events for person with only one event. Not the prettiest syntax but I think it will work when I try it one the large dataset.
*Calculate period between events, in days. First sort on person and first day of event. COMPUTE diffdays=CTIME.DAYS(indate-LAG(outdate)). EXE. *The event is new if it has been more than 28 days since the last one. IF diffdays >28 newevent=1. Exe. * Create sequence numbers for every event for every person (ID). This is done to fix a personĀ“s first event and events for person with only one event. SORT CASES BY id(A). MATCH FILES /FILE=* /BY id /FIRST=PrimaryFirst /LAST=PrimaryLast. DO IF (PrimaryFirst). COMPUTE MatchSequence=1-PrimaryLast. ELSE. COMPUTE MatchSequence=MatchSequence+1. END IF. LEAVE MatchSequence. FORMATS MatchSequence (f7). MATCH FILES /FILE=* /DROP=PrimaryFirst PrimaryLast. VARIABLE LABELS MatchSequence 'Sequential count of matching cases'. VARIABLE LEVEL MatchSequence (SCALE). EXECUTE. *0= A person with only one event, 1= The first event for a person. Both are considered "new". IF (MatchSequence =0 or MatchSequence=1) newevent=1. EXE. Best wishes Henrik Dal |
Administrator
|
COMPUTE MatchSequence=SUM(1,LAG(MatchSequence)*(ID EQ LAG(ID))).
;-))
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?" |
Administrator
|
OTOH: Maybe you need only:
IF (ID EQ LAG(ID)) diffdays=CTIME.DAYS(indate-LAG(outdate)).
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?" |
Hi everyone,
I'm working with a very large custom table (more than 1,000 rows and columns) that needs to be pasted into an excel sheet. Everytime I try to copy in SPSS it lags due to the large amount of memory required. Does anyone know a trick or method to best copy this over without it crashing SPSS or freezing? Thanks, Amy |
Administrator
|
OMS!!??!!
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?" |
In reply to this post by Hong A Ng
For a big table, it's much better to use
OMS to create the Excel file or to use the OUTPUT EXPORT command. You
can also use Copy Special to select only one clipboard format.
Still better, construct a smaller table! I suspect that you are really constructing data, and there might be better ways to do that. HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Hong A Ng <[hidden email]> To: [hidden email] Date: 06/07/2012 12:59 PM Subject: [SPSSX-L] Best way to copy large table from SPSS to Excel? Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi everyone, I'm working with a very large custom table (more than 1,000 rows and columns) that needs to be pasted into an excel sheet. Everytime I try to copy in SPSS it lags due to the large amount of memory required. Does anyone know a trick or method to best copy this over without it crashing SPSS or freezing? Thanks, Amy |
In reply to this post by Hong A Ng
Thanks C for your reply,
I tried exporting it but the table seems to be too big - I keep getting an application error telling me that there is not enough memory. I've tried exporting it to html too and neither seems to work. Amy From: [hidden email] To: [hidden email] Subject: Re: Best way to copy large table from SPSS to Excel? Date: Thu, 7 Jun 2012 21:13:19 +0200 Instead of copy, try to export your dataset. I would save the dataset as .csv or .xsl From the interfaceface is very simple: File > Save As > Chose .xsl or .cvs as a format. here the syntax: SAVE TRANSLATE OUTFILE='*your_path*' /TYPE=XLS /VERSION=8 /MAP /REPLACE /FIELDNAMES /CELLS=VALUES. Instead of *your_path* put the where you want to put the file, somethi Then Excel will open it without problems. bye. c. 07.06.2012, 20:56, "Hong A Ng" <[hidden email]>:
|
In reply to this post by Hong A Ng
I know older versions of Excel had max. 256 columns. Make sure your version supports enough columns.
Instead of copy/paste, try File>export in SPSS. There is an option to send output to Excel. regards, Ian Ian D. Martin, Ph.D. Tsuji Laboratory University of Waterloo Dept. of Environment & Resource Studies On Jun 7, 2012, at 2:56 PM, Hong A Ng wrote: > Hi everyone, > > I'm working with a very large custom table (more than 1,000 rows and columns) that needs to be pasted into an excel sheet. > Everytime I try to copy in SPSS it lags due to the large amount of memory required. > Does anyone know a trick or method to best copy this over without it crashing SPSS or freezing? > > Thanks, > Amy > ===================== 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 David Marso
Output Export command or File>Export
on the Viewer menus
Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] Phone: 312.893.4922 | T/L: 206-4922 From: David Marso <[hidden email]> To: [hidden email] Date: 06/07/2012 02:11 PM Subject: Re: Best way to copy large table from SPSS to Excel? Sent by: "SPSSX(r) Discussion" <[hidden email]> OMS!!??!! -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/New-disease-events-tp5713508p5713573.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== 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 Jon K Peck
Thanks for your helpful suggestion Jon! I'm not familiar yet with OMS so I will look into it. I am helping a colleague out on a past study that is repeated and he is using the tables to create a dashboard in Excel. I am just helping him export the table as it is a tedious and time/resource intensive task. Your suggestion of 'Copy Special' worked! I used the 'Excel Worksheet (BIFF)' and it seems to do the trick. Thank you very much for your assistance again! Amy To: [hidden email] CC: [hidden email] Subject: Re: [SPSSX-L] Best way to copy large table from SPSS to Excel? From: [hidden email] Date: Thu, 7 Jun 2012 13:20:08 -0600 For a big table, it's much better to use OMS to create the Excel file or to use the OUTPUT EXPORT command. You can also use Copy Special to select only one clipboard format. Still better, construct a smaller table! I suspect that you are really constructing data, and there might be better ways to do that. HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Hong A Ng <[hidden email]> To: [hidden email] Date: 06/07/2012 12:59 PM Subject: [SPSSX-L] Best way to copy large table from SPSS to Excel? Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi everyone, I'm working with a very large custom table (more than 1,000 rows and columns) that needs to be pasted into an excel sheet. Everytime I try to copy in SPSS it lags due to the large amount of memory required. Does anyone know a trick or method to best copy this over without it crashing SPSS or freezing? Thanks, Amy |
Free forum by Nabble | Edit this page |