And a quick note: beware of running analyses, Muayyad, just by point and click. Syntax files leave you with an audit trail. Your data preparation and analysis is reproducible and defensible. With point and click, you're completely vulnerable.
I posted an answer to this same question back in 2005. You can see that post at the link below. But nowadays, SPSS can have multiple datasets open. So I would revise it slightly as below (untested, as I don't have SPSS on this computer). HTH.
* ---- Computing Cohen's d -------------- .
* Send GROUP STATISTICS table to a file with OMS .
DATASET DECLARE GroupStats.
OMS
/SELECT TABLES
/IF COMMANDS = ["T-TEST"]
SUBTYPES = ["Group Statistics"]
/DESTINATION FORMAT = SAV NUMBERED = test viewer = yes
OUTFILE = "GroupStats".
* The dataset containing the raw data must be active at this point.
to do independent sample ttest, you dont need syntax, it will cause you troubles in replacing the name of the variables with the exact spaces...etc.
you only need to go to Analyse, compare means, indpenedent sample ttest. then specify your IV and DV. {for IF, you need to define the code which the 2 groups have,, such as 1 & 2 for males and females}. it is easy like this. goood luck
for Cohen's D, you just link to the following site, you need to have the SD and sample size for the 2 groups, you will get the Cohen's D
Muayyad Ahmad wrote: "to do independent sample ttest, you dont need syntax, it will cause you troubles in replacing the name of the variables with the exact spaces...etc."
While it is true you don't have to use syntax, the rest of that comment is nonsense, in my opinion. For one thing, it ignores and obscures the multiple benefits of learning to use syntax. See the web-pages linked below for a list of those benefits (especially the second link).
If you are new to using syntax, I suggest starting by exiting the GUI dialogs via the PASTE button rather than OK. This is how most of the syntax users I know got their start. Over time, you will find that for commands you use frequently, it is quicker to just type the command directly in the syntax editor. For other commands that you use less frequently, or that have a lot of sub-commands and options, you will quite possibly always use the GUI to generate a first draft of the command (via the PASTE button). There is nothing wrong with that--I know some folks with decades of experience who are very accomplished syntax users who do exactly that.
And a quick note: beware of running analyses, Muayyad, just by point and click. Syntax files leave you with an audit trail. Your data preparation and analysis is reproducible and defensible. With point and click, you're completely vulnerable.
Thanks for catching that. I'd used the one-sample square root formula instead of the independent samples. I've updated the walk-through and we should now have fidelity in conclusions. Best.