Login  Register

Re: Flip command and string vars

Posted by David Marso on Nov 19, 2013; 4:58pm
URL: http://spssx-discussion.165.s1.nabble.com/Flip-command-and-string-vars-tp5723152p5723159.html


Where is my sharpened spoon ;-)

Albert-Jan Roskam wrote
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
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?"