*SPSS syntax example by www.spss-tutorials.com.

*Create Test Data with 40 cases.
data list free/somevar.
begin data
0 0 0 0 0     0 0 0 0 0     0 0 0 0 0     0 0 0 0 0     0 0 0 0 0     0 0 0 0 0     0 0 0 0 0     0 0 0 0 0    
end data.

*First 17 cases 1, last 23 cases 0.
compute somevar = ($casenum <= 17).
value labels somevar 0 'No' 1 'Yes'.

*IMPORTANT: MAKE SURE 0 AND 1 ARE THE ONLY VALID VALUES IN VARIABLE BEFORE PROCEEDING.
*The two lines below confirm this holds.
set tnumbers both.
frequencies somevar.

*Proportion = 0.425 because 42.5% out of 40 respondents said "Yes".

*Analyze => Compare Means => One-Sample T Test. Run with default settings.
T-TEST
/TESTVAL=0
/MISSING=ANALYSIS
/VARIABLES=somevar
/CRITERIA=CI(.95).

*Testvalue = 0 so proportion = "Mean difference" in output.

*Last two columns: confidence interval for proportion runs from 0.2649 through 0.5851.

*According to z-test (not in SPSS): 0.272 < p < .578.