<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4410992510011878517</id><updated>2012-02-09T08:44:28.004+01:00</updated><title type='text'>I love spss</title><subtitle type='html'>SPSS, code, programming, macros, batch, executes, data, database.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-7363899001279126006</id><published>2007-10-21T20:03:00.000+01:00</published><updated>2007-10-21T20:15:29.256+01:00</updated><title type='text'>Migrating data from SPSS to SQL Server 2005</title><content type='html'>SQL Server 2005 has among Native SQL Server also OLEDB connection which enables you to import data to you favorite SPSS version.&lt;br /&gt;&lt;br /&gt;Using SPSS Syntax you can with almost no haste import data - using T-Sql Query to SPSS.&lt;br /&gt;&lt;br /&gt;[Code]&lt;br /&gt;&lt;p style="font-family: courier new;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt;"&gt;*sql-&gt;spss.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: courier new;" class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt;"&gt;get data&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-family: courier new;font-family:Courier New;font-size:85%;"  &gt;&lt;span style="font-size: 10pt;"&gt;/type=odbc&lt;br /&gt;/connect='Driver={SQLServer};Server=My_server_name;Uid=My_User_name;Pwd=My_password;database=My_database'&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family: courier new;font-family:Courier New;font-size:85%;"  &gt;&lt;span style="font-size: 10pt;"&gt;/sql =&lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;'select&lt;/span&gt;&lt;/span&gt; id&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;/span&gt; name&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;/span&gt; &lt;span style="color:fuchsia;"&gt;&lt;span style="color: fuchsia;"&gt;cast&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:fuchsia;"&gt;&lt;span style="color: fuchsia;"&gt;round&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:fuchsia;"&gt;&lt;span style="color: fuchsia;"&gt;cast&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:fuchsia;"&gt;&lt;span style="color: fuchsia;"&gt;datediff&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:fuchsia;"&gt;&lt;span style="color: fuchsia;"&gt;day&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;/span&gt; BirthDate&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;/span&gt; &lt;span style="color:fuchsia;"&gt;&lt;span style="color: fuchsia;"&gt;getdate&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;())&lt;/span&gt;&lt;/span&gt; &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;/span&gt; &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;float&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;/&lt;/span&gt;&lt;/span&gt; 365.25&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;/span&gt; 0&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;/span&gt; &lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;-&lt;/span&gt;&lt;/span&gt;1&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;/span&gt; integer&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;,(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;select&lt;/span&gt;&lt;/span&gt; &lt;span style="color:fuchsia;"&gt;&lt;span style="color: fuchsia;"&gt;max&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;(date_time&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;from&lt;/span&gt;&lt;/span&gt; table1 &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;where&lt;/span&gt;&lt;/span&gt; table1.date = date2&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;/span&gt; &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;/span&gt; Another_Date &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;from&lt;/span&gt;&lt;/span&gt; table2  &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;/span&gt; t2 &lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;join&lt;/span&gt;&lt;/span&gt; table3 &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;/span&gt; t3 &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;on&lt;/span&gt;&lt;/span&gt; t2.id = t3&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;/span&gt;id &lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;join&lt;/span&gt;&lt;/span&gt; table4 as t4 &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;on t2.date = t4.id&lt;/span&gt;&lt;/span&gt; &lt;span style="color:blue;"&gt;&lt;span style="color: blue;"&gt;where&lt;/span&gt;&lt;/span&gt; t4.my_number = 1&lt;span style="color:gray;"&gt;&lt;span style="color: gray;"&gt;&lt;/span&gt;&lt;/span&gt;'&lt;br /&gt;cache.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;[/Code]&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;Where parameters My_server_name, My_username, My_password and My_database should be replaced.&lt;/p&gt;&lt;br /&gt;SQL query should be enclosed in single aphostrophe '  and your SQL query should not contain any single quotes for enabling strings (eg.: where name = 'John').&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-7363899001279126006?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/7363899001279126006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=7363899001279126006' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/7363899001279126006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/7363899001279126006'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/10/migrating-data-from-spss-to-sql-server.html' title='Migrating data from SPSS to SQL Server 2005'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-2485049691449826632</id><published>2007-05-10T08:18:00.000+01:00</published><updated>2007-05-10T09:10:56.229+01:00</updated><title type='text'>Simple Macro</title><content type='html'>&lt;acronym title="the Statistical Package for the Social Sciences"&gt;&lt;/acronym&gt;SPSS provides the capability to create macros that contain text and &lt;acronym title="the Statistical Package for the Social Sciences"&gt;&lt;/acronym&gt;SPSS command syntax. Macros can perform the same command repeatedly, combine          several procedures, or calculate user-defined statistics. Any functions          you can perform using &lt;acronym title="the Statistical Package for the Social Sciences"&gt;&lt;/acronym&gt;SPSS syntax can be incorporated into a macro. When a macro is called, it is          expanded so that any text including commands will be used in its place.&lt;br /&gt;&lt;br /&gt;Simple macro that differs between nominal, ordinal and scale variables and when you run this macro, it gives different statistics to specific variable type.&lt;br /&gt;&lt;br /&gt;[SPSS]&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;DEFINE !sumstat (catvars = !CHAREND('/')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    /scalevars = !CMDEND)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; !IF (!catvars ~=!NULL) !THEN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; frequencies variables = !catvars&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    /barchart.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; !IFEND&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; !IF (!scalevars ~= !NULL) !THEN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; frequencies variables = !scalevars&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    /format = notable&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    /statistics = mean median min max&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    /histogram.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; !IFEND&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;!ENDDEFINE.&lt;/span&gt;&lt;br /&gt;[/SPSS]&lt;br /&gt;&lt;br /&gt;To run this macro use:&lt;br /&gt;[SPSS]&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;!sumstat catvars = gender opinion1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    /scalevars = age salary.&lt;/span&gt;&lt;br /&gt;[/SPSS]&lt;br /&gt;&lt;br /&gt;When you run the last chunk of this code you will get in output window for nominal/ordinal variables different statistics and barchart, whereas for scale variables you will get statistics as mean, median, min, max and histogram.&lt;br /&gt;&lt;br /&gt;If it seems to complicated, you can still use this :-)&lt;br /&gt;&lt;br /&gt;[SPSS]&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Freq all.&lt;/span&gt;&lt;br /&gt;[/SPSS]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-2485049691449826632?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/2485049691449826632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=2485049691449826632' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/2485049691449826632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/2485049691449826632'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/05/simple-macro.html' title='Simple Macro'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-4016427581140772749</id><published>2007-03-09T10:27:00.000+01:00</published><updated>2007-03-09T10:59:45.972+01:00</updated><title type='text'>SEED to produce random samples of values</title><content type='html'>When you want to produce a random set of numbers - e.g.: randomly assigning cases to experimental treatments of group - one should set random number seed value if you want to get the same result.&lt;br /&gt;&lt;br /&gt;Random generator is used by SAMPLE command to generate random samples and is used by several distribution functions (NORMAL, UNIFORM). Integer begins with SEED - large integer. At the start SEED is set to a value that may vary or may be fixed, depending on your current setting. The seed value changes each time a series of transformations contains one or more commands that use the random number generator.&lt;br /&gt;&lt;br /&gt;To use the same random distribution  within a session on in subsequent session, use SET SEED before each series of transformations that use the random number generator to explicitly set the seed value to a constant value.&lt;br /&gt;&lt;br /&gt;[SPSS Syntax]&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;GET FILE = 'c:\file.sav'.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;SET SEED = 123456789.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;SAMPLE .1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;LIST.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;SHOW SEED.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;GET FILE = 'c:\file.sav'.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;SET SEED = 123456789.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;SAMPLE .1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;LIST.&lt;/span&gt;&lt;br /&gt;[/SPSS Syntax]&lt;br /&gt;&lt;br /&gt;Before the first sample is taken for the first time, the SET SEED is set. The LIST command causes data to be read and the generator number to be invoked once for each  original case.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-4016427581140772749?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/4016427581140772749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=4016427581140772749' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/4016427581140772749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/4016427581140772749'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/03/seed-to-produce-random-samples-of.html' title='SEED to produce random samples of values'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-8053691017467901297</id><published>2007-01-15T09:49:00.000+01:00</published><updated>2007-01-15T10:16:50.051+01:00</updated><title type='text'>Cases to Variables and Variables to Cases</title><content type='html'>Some SPSS techiques are based on the assumption that cases (rows) represent independent obervations and/or that related observations are recorded in separate variables rather than separate cases. If data file contains groups of related cases, you may not be able to use the appropriate statistical techniques (Paired Samples T Test of Repeated Measures GLM) because the data are not organized in the required fashion for those techniques.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;CASETOVARS&lt;/span&gt; command combines the related cases and produces the new variables.&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;GET FILE='c:\sample.sav'.&lt;br /&gt;SORT CASES BY ID_number.&lt;br /&gt;CASETOVARS&lt;br /&gt;     /ID = ID_number&lt;br /&gt;     /INDEX = ID_person&lt;br /&gt;     /SEPARATOR = "_"&lt;br /&gt;     /COUNT = famsize.&lt;br /&gt;&lt;/span&gt;VARIABLE LABELS&lt;br /&gt;    Income_1 "30K+"&lt;br /&gt;    Income_2 "40K+"&lt;br /&gt;    Income_3 "50K+".&lt;br /&gt;[/Syntax]&lt;br /&gt;&lt;br /&gt;Sort Cases sorts the data file by the variable that will be used to group cases in CASETOVARS command. The data file must be sorted by the variable specified on the ID subcommand of the CASETOVARS command. The ID subcommand of the CASETOVARS indicates the variables that will be used to group cases together. In this example, all cases with the same value for ID_number will become a single case in the restructured file.&lt;br /&gt;&lt;br /&gt;Optional INDEX allocate all unique values of all non-ID variables. E.g.: only values of ID_number will be used to generate new variable. SEPARATOR subcommand specifies the character that will be used to separate original variable names and the values appended to those names for the new variable names in the restructured file. By default, a period is used. The COUNT subcommand will create a new variable that indicates the number of original cases represented by each combined case in the restructured file.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;VARSTOCASES&lt;/span&gt; command creates the exact opposite.  A simple excel file contains two columns of information: income for males and income for females. There is no known or assumed relationship between male and female values that are recorded in the same row; the two columns represent independent (unrelated) observations, and we want to create cases (rows) from the columns (variables) and create new variable that indicate the gender for each case.&lt;br /&gt;&lt;br /&gt;[Excel input data]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Male_income   Female_income&lt;br /&gt;123                567&lt;br /&gt;234                 678&lt;br /&gt;345                789&lt;br /&gt;456                890&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: arial;"&gt;[/Excel input data]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;[Syntax]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;GET DATA /TYPE=XLS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /FILE = 'c:\sample.xls'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /READNAMES = ON.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;VARSTOCASES&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /MAKE Income FROM Male_income Female_income&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /INDEX = Gender&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;VALUE LABELS Gender 1 'Male' 2 'Female'.&lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;br /&gt;&lt;br /&gt;The MAKE subcommand creates a sinble income variable from the two original income variables. The INDEX subcommand creates a new variable named Gender with integer values that represent the sequential order in which the original variables are specified on the MAKE subcommand.&lt;br /&gt;&lt;br /&gt;[SPSS dataview]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Gender         Income&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1                 123&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;2                 567&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1                 234&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;2                 678&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1                 345&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;2                 789&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1                456&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;2                 890&lt;/span&gt;&lt;br /&gt;[/SPSS dataview]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-8053691017467901297?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/8053691017467901297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=8053691017467901297' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/8053691017467901297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/8053691017467901297'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/01/cases-to-variables-and-variables-to.html' title='Cases to Variables and Variables to Cases'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-8480782172455198810</id><published>2007-01-12T14:28:00.000+01:00</published><updated>2007-01-12T14:45:42.551+01:00</updated><title type='text'>Transposing cases and variables</title><content type='html'>Two most common commands are generally used for data transposing. &lt;span style="font-weight: bold;"&gt;FLIP&lt;/span&gt; command creates a new data file in which the rows adn columns in the original data are transposed so that cases (rows) become variables (columns) or vice versa. &lt;span style="font-weight: bold;"&gt;CASETOVAR&lt;/span&gt; command is in this manner more complex method where one can namely restructure data not only by flipping rows and columns.&lt;br /&gt;&lt;br /&gt;Let's say you want to read (or import) the Excel spreadsheet and transpose the rows and columns:&lt;br /&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;GET DATA /TYPE=XSL&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /FILE='C:\example.xsl'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /READNAMES=ON.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;FLIP VARIABLES=Sport Devices Cars&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /NEWNAME=V1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;RENAME VARIABLES (CASE_LBL= Type).&lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;br /&gt;&lt;br /&gt;Readnames=on reads the first row of the excel spreadsheet as variable names. The original variables names (sport, devices, cars) are automatically stored as values in a new variable called CASE_LBL. Subsequent rename variables command changed the name of this vvariable to Type.&lt;br /&gt;&lt;br /&gt;[EXCEL DATA]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        SPORT    DEVICES    CARS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;ID        12        32        33&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;STORE   2            5        4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;COST    12,000    32,200    1,000&lt;/span&gt;&lt;br /&gt;[/EXCEL DATA]&lt;br /&gt;&lt;br /&gt;[Transposed data in SPSS]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Type        ID        STORE        COST&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1    SPORT      12            2        12,000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;2    DEVICES    32            5        32,200&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;3    CARS        33            4        1,000&lt;/span&gt;&lt;br /&gt;[/Transposed data in SPSS]*&lt;br /&gt;*&lt;span style="font-size:78%;"&gt;in DataView&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-8480782172455198810?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/8480782172455198810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=8480782172455198810' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/8480782172455198810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/8480782172455198810'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/01/transposing-cases-and-variables.html' title='Transposing cases and variables'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-6340045264988738504</id><published>2007-01-11T09:48:00.000+01:00</published><updated>2007-01-11T10:02:09.060+01:00</updated><title type='text'>Weighting data</title><content type='html'>The WEIGHT command stimulates case replication by treating each case as if it were actually the number of cases indicated by the value of the weight variable. Weight variable can be used to (1) adjust the distribution of cases to more accurately reflect the larger population or (2) to simulate raw data from aggregated data.&lt;br /&gt;&lt;br /&gt;In first case, sample data contains following distribution; 52% males and 48% females, but in reality gender distributes as 49% males and 51% females.&lt;br /&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DO IF gender='male'.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;-    COMPUTE weightvar=49/52.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;ELSE IF gender='female'.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;-    COMPUTE weightvar=51/48.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;END IF.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;WEIGHT By weightvar.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;FREQ variables=gender.&lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;br /&gt;&lt;br /&gt;DO IF structure sets value of weightvar for males (49/52; 0.94) and different value for females (51/48). The formula used is: desired proportion/observed proportion.&lt;br /&gt;&lt;br /&gt;In second case of simulating raw data from aggregated file, variable count will be weight variable.&lt;br /&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DATA LIST LIST /income gender count.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Begin data&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1, 1, 25&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1, 2, 35&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;2, 1, 30&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;2, 2, 10&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;END DATA.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Value labels&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Income 1 'under $50K' 2 '$50K+'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Gender 1 'Male' 2 'Female'.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Weight BY count.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;&lt;br /&gt;CROSSTABS TABLES=income by gender.&lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;br /&gt;&lt;br /&gt;Variable count corresponds with the original frequency of the cases.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-6340045264988738504?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/6340045264988738504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=6340045264988738504' title='29 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/6340045264988738504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/6340045264988738504'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/01/weighting-data.html' title='Weighting data'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>29</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-2155689195964322532</id><published>2007-01-09T09:06:00.000+01:00</published><updated>2007-01-09T09:19:08.674+01:00</updated><title type='text'>Finding invalid values</title><content type='html'>Data might contain errors, which can be cought by simple cleaning routines.  Invalid data values can include anything from simple out-of-range values to complex combinations of values that should not occur.&lt;br /&gt;&lt;br /&gt;This sample contains a variable quantity that represents only valid values (e.g. integer values). Command syntax exlude invalid data from analysis.&lt;br /&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DATA LIST FREE /quantity.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;BEGIN DATA&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1 1.1 2 5 8.01 2.31 4.11 5.85&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;END DATA.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;COMPUTE filtervar=(MOD(quantity,1)=0).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;FILTER by filtervar.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;SUMMARIZE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /TABLES=quantity&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /FORMAT=LIST CASENUM NOTOTAL&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /CELLS=COUNT.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;FILTER OFF.&lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;br /&gt;&lt;br /&gt;Compute command creates a new variable with MOD function. If quantity divided by 1 is 0, then the expression is true and filtervar will have a value of 0. For integer values, filtervar is set to 1.&lt;br /&gt;*This solution filters out the entire case, including valid values for other variables in data file!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Slightly better solution is to assign invalid values to a user-missing category, which indentifies values that shold be excluded or treated in a special manner for that variable.&lt;br /&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DATA LIST FREE /quantity.&lt;/span&gt;&lt;br /&gt; &lt;span style="font-family: courier new;"&gt;BEGIN DATA&lt;/span&gt;&lt;br /&gt; &lt;span style="font-family: courier new;"&gt;1 1.1 2 5 8.01 2.31 4.11 5.85&lt;/span&gt;&lt;br /&gt; &lt;span style="font-family: courier new;"&gt;END DATA.&lt;br /&gt;IF (MOD(quantity,1)&gt;0) quantity = (-9).&lt;br /&gt;MISSING VALUES quantity (-9).&lt;br /&gt;VALUE LABELS quantity -9 "Non-integer values".&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: courier new;"&gt;&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;SUMMARIZE&lt;/span&gt;&lt;br /&gt; &lt;span style="font-family: courier new;"&gt;    /TABLES=quantity&lt;/span&gt;&lt;br /&gt; &lt;span style="font-family: courier new;"&gt;    /FORMAT=LIST CASENUM NOTOTAL&lt;/span&gt;&lt;br /&gt; &lt;span style="font-family: courier new;"&gt;    /CELLS=COUNT.&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;&lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-2155689195964322532?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/2155689195964322532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=2155689195964322532' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/2155689195964322532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/2155689195964322532'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/01/finding-invalid-values.html' title='Finding invalid values'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-4746629433576438269</id><published>2007-01-08T12:54:00.000+01:00</published><updated>2007-01-13T09:36:28.617+01:00</updated><title type='text'>Temporary variable SCRATCH</title><content type='html'>Any variable name that begins with a pound sign (#) is treated as a scratch variable that is discardd at the end of the series of transformation commands.&lt;br /&gt;Simple sample:&lt;br /&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;DATA LIST FREE /var1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;BEGIN DATA&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;1 2 3 4 5 6&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;END DATA.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;COMPUTE factor=1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;LOOP #tempvar=1 TO var1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;- COMPUTE factor=factor * #tempvar.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;END LOOP.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;EXECUTE.&lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;scratch variable&lt;/span&gt; #tempvar is used as an index variable for the loop structure. For each case, the COMPUTE command is run iteratively up to the value of &lt;span style="font-style: italic;"&gt;var1&lt;/span&gt;. For each iteration the current value of the variable factor is multiplied by the current loop iteration number stored in #tempvar.&lt;br /&gt;&lt;br /&gt;Result will be:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;1 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;2 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;3 6&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;4 24&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;5 120&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;6 720&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-4746629433576438269?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/4746629433576438269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=4746629433576438269' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/4746629433576438269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/4746629433576438269'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/01/temporary-variable-scratch.html' title='Temporary variable SCRATCH'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-7445558608421172194</id><published>2007-01-08T12:50:00.000+01:00</published><updated>2007-01-08T12:53:51.400+01:00</updated><title type='text'>Using TEMPORARY for transforming existing variables</title><content type='html'>The Temporary transformations remain effective through the first command that reads the data, after which the variables revert to original values. Here is a quick example how to use &lt;span style="font-weight: bold;"&gt;Temporary&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DATA LIST FREE /var1 var2.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;BEGIN DATA&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;3 4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;5 6&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;7 8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;9 10&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;END DATA.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;TEMPORARY.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;COMPUTE var1 = var1+5.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;RECODE var2 (1 thru 5=1) (6 thru 10=2).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;FREQ&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; /VARIABLES = var1 var2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; /STATISTICS = MEAN STDDEV MIN MAX.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DESCRIPTIVES&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; /VARIABLES = var1 var2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; /STATISTICS = MEAN STDDEV MIN MAX. &lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-7445558608421172194?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/7445558608421172194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=7445558608421172194' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/7445558608421172194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/7445558608421172194'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/01/using-temporary-for-transforming.html' title='Using TEMPORARY for transforming existing variables'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-4212849752639159253</id><published>2007-01-06T12:43:00.000+01:00</published><updated>2007-01-06T12:48:23.894+01:00</updated><title type='text'>Checking input data</title><content type='html'>A simple Syntax like this can make your *.sav file coherent, logic and might even help you when you need to locate any cases that does not follow your research pattern.&lt;br /&gt;&lt;br /&gt;Here is a fairly simple check:&lt;br /&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DATA LIST FREE &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /age gender pregnant.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;BEGIN DATA&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;25 0 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;12 1 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;80 1 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;47 0 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;34 0 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;9  1 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;19 0 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;27 0 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;END DATA.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;VALUE LABELS &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /gender 0 'male' 1 'female'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /pregnant 0 'No' 1 'Yes'.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;COMPUTE valueCheck = 0.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DO IF pregnant = 1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;      DO IF  gender = 0.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Compute valuecheck = 1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;      ELSE IF gender = 1.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        DO IF age &gt; 55.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Compute valuecheck = 2.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        ELSE IF age &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Compute valuecheck = 3.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        END IF.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    END IF.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;END IF.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;VALUE LABELS valuecheck&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;0 'NO problems detected'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;1 'Male and pregnant'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;2 ' age &gt; 55 and pregnant'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;3 ' age &lt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;FREQ variables = valueCheck. &lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;br /&gt;&lt;br /&gt;Life becomes even more easier when you use this in a script that runs immediately, when you open *.sav file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-4212849752639159253?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/4212849752639159253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=4212849752639159253' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/4212849752639159253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/4212849752639159253'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/01/checking-input-data.html' title='Checking input data'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4410992510011878517.post-4138643732166350625</id><published>2007-01-04T14:43:00.000+01:00</published><updated>2007-01-04T15:10:32.788+01:00</updated><title type='text'>Getting data into SPSS</title><content type='html'>Several ways of introducing data to SPSS!&lt;br /&gt;&lt;br /&gt;1. Type  data by yourself and die!&lt;br /&gt;2. Open data file (*.sav) and be happy!&lt;br /&gt;3. Import data from Excel file (*.xls).&lt;br /&gt;4. Import data from Database (via ODBC, etc.).&lt;br /&gt;&lt;br /&gt;In the last case, Syntax should look like this:&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;GET DATA &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /TYPE=ODBC&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /CONNECT='DNS=MS Access Database;DBQ=C:\demo.mdb;'+'DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /SQL =&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    'SELECT Age, Education, Income'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    'FROM GeneralInfosTable'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    'WHERE ([Marital Status] &lt;&gt; 2 AND MobilePhone = 1)'.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;EXECUTE.&lt;/span&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;As we can see that we import data from Microsoft Access Database under certain conditions.&lt;br /&gt;&lt;br /&gt;If you want to do the Excel way, you might consider this:&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;GET DATA&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /TYPE=XLS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /FILE='c:\demo.xls'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /SHEET=NAME 'Income'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /CELLRANGE= RANGE 'A1:K23'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /READNAMES=on.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;EXECUTE.&lt;/span&gt;&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;br /&gt;And if you want to read from a text (*.txt) file use:&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DATA LIST FREE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    FILE ='c:\delimited_numbers.txt'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    /id (f4) sex (a1) age (F2) opinion1 to opinion5 (5F).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;EXECUTE.&lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;br /&gt;&lt;br /&gt;Or you can - god noooo - type in all the data (directly to your SPSS Data View or you can use smth. like this):&lt;br /&gt;[Syntax]&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;DATA LIST FREE&lt;br /&gt;    /var1(f2) var2(f2) var3(f2) var4(f3) var5(f2) name(a10).&lt;br /&gt;BEGIN DATA&lt;br /&gt;12  22  31  42  51 john&lt;br /&gt;22  23  42  44  21 marry&lt;br /&gt;55  53  32  11  12 fred&lt;br /&gt;END DATA.&lt;br /&gt;EXECUTE.&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;&lt;/span&gt;&lt;br /&gt;[/Syntax]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4410992510011878517-4138643732166350625?l=ilovespss.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ilovespss.blogspot.com/feeds/4138643732166350625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4410992510011878517&amp;postID=4138643732166350625' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/4138643732166350625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4410992510011878517/posts/default/4138643732166350625'/><link rel='alternate' type='text/html' href='http://ilovespss.blogspot.com/2007/01/getting-data-into-spss.html' title='Getting data into SPSS'/><author><name>i love spss</name><uri>http://www.blogger.com/profile/08700475235526123277</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>11</thr:total></entry></feed>
