Given a dataset of only string vars of the same dimension, e.g., a5, I’m curious as to why the Flip command returns sysmis for the rearranged dataset. I understand that this is a very specific situation and maybe that’s a good enough reason.
And I understand why flip won’t work for a mixed dataset of either strings and numeric or strings of varying dimensions.
Gene Maguin |
It's documented by I have no idea why it behaves this way. In R you can use t(), so with a string-only dataset you can do:
begin program r. cases = spssdata.GetCaseCount() dta <- as.data.frame(t(spssdata.GetDataFromSPSS())) varName <- paste("v", 1:cases, sep="") varLabel <- rep("", cases) varType <- rep(8, cases) # assume only A8 vars varFormat <- rep("A8", cases) varMeasurementLevel <- rep("nominal", cases) dict <- as.data.frame(t(data.frame(varName, varLabel, varType, varFormat, varMeasurementLevel))) rownames(dict) <- c("varName", "varLabel", "varType", "varFormat", "varMeasurementLevel") names(dict) <- varName spssdictionary.SetDictionaryToSPSS("transposed", dict) spssdata.SetDataToSPSS("transposed", dta) spssdictionary.EndDataStep() end program. Regards, Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -------------------------------------------- On Tue, 11/19/13, Maguin, Eugene <[hidden email]> wrote: Subject: [SPSSX-L] Flip command and string vars To: [hidden email] Date: Tuesday, November 19, 2013, 4:28 PM Given a dataset of only string vars of the same dimension, e.g., a5, I’m curious as to why the Flip command returns sysmis for the rearranged dataset. I understand that this is a very specific situation and maybe that’s a good enough reason. And I understand why flip won’t work for a mixed dataset of either strings and numeric or strings of varying dimensions. 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 |
Administrator
|
In reply to this post by Maguin, Eugene
In all likelihood because FLIP is a brain-dead procedure and all the smart people were on vacation when they had the design meetings (FLIP is certainly pre 1990).
Hint Gene: Both VARSTOCASES and CASESTOVARS respect strings. Furthermore they can use mixed length strings (setting the result to maximum). In response to many angry callers and faxes, I created a 'workaround' in the early 90's using XSAVE in a loop followed by a VECTOR/AGGREGATE combo. IIRC it was a pain because VECTOR also requires same size strings. To make it flexible required building a new set of variables with a known max-size and tossing those into the XSAVE loop. That is now happily long obsolete since VARSTOCASES and CASESTOVARS (circa 2000 or so). DATA LIST FREE / a b (2A1) c d z (3A6). BEGIN DATA a b c d z z d c b a END DATA. VARSTOCASES /ID=id /MAKE stack FROM a TO z /INDEX=oldvar(stack) . ALTER TYPE id (a10). COMPUTE id=CONCAT("Case_",LTRIM(id)). SORT CASES BY oldvar id. CASESTOVARS /ID=oldvar/INDEX=id /GROUPBY=VARIABLE.
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
|
In reply to this post by Albert-Jan Roskam
Where is my sharpened spoon ;-)
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?" |
Free forum by Nabble | Edit this page |