SHAZAM Community
Ask Your Question

Revision history [back]

This is easy using the SKIPIF command.

Here is an example

sample 1 3
read a b
1 2
3 4
1 5

* Stat on entire sample
stat a b

* Set skip if rule and re do.
skipif(a.eq.1)
stat a b

This is easy using the SKIPIF command.

Here is an example

sample 1 3
read a b
1 2
3 0 4
1 5

* Stat on entire sample
stat a b

* Set skip if rule and re do.
skipif(a.eq.1)
skipif(a.ne.1)
stat a b

This is easy using the SKIPIF command.

Here is an example

sample 1 3
read a b
dummy myvar
1 2
0 4
1 5

* Stat on entire sample
Use SKIPIF to calculate statistics for observations only where variable dummy = 1.
skipif(dummy.eq.1)
stat a b

* Set skip if rule and re do.
skipif(a.ne.1)
stat a b
myvar

This is easy using the SKIPIF command.

Here is an example

sample 1 3
read dummy myvar
1 2
0 4
1 5

* Use SKIPIF to calculate statistics for observations only where variable dummy = 1.
skipif(dummy.eq.1)
stat myvar

Welcome to SHAZAM (Double Precision) v11.1 - APR 2014 WIN-NT PAR=112400
...NOTE..CURRENT WORKING DIRECTORY IS: C:\Users\David.SOFTWAREONE\Documents\SHAZAM\Test

sample 1 3

read dummy myvar

...NOTE.. 2 VARIABLES AND 3 OBSERVATIONS STARTING AT OBS 1

* Use SKIPIF to calculate statistics for observations only where variable dummy = 1.
skipif(dummy.eq.1)

...NOTE..OBSERVATION 1 WILL BE SKIPPED
...NOTE..OBSERVATION 3 WILL BE SKIPPED

stat myvar

Name N Mean St. Dev Variance Minimum Maximum
MYVAR 1 4.0000 0.0000 0.0000 4.0000 4.0000

This is easy using the SKIPIF command.

Here is an example

sample 1 3
read dummy myvar
1 2
0 4
1 5

* Use SKIPIF to calculate statistics for observations only where variable dummy = 1.
skipif(dummy.eq.1)
skipif(dummy.ne.1)
stat myvar

Welcome to SHAZAM (Double Precision) v11.1 - APR 2014 WIN-NT PAR=112400
...NOTE..CURRENT WORKING DIRECTORY IS: C:\Users\David.SOFTWAREONE\Documents\SHAZAM\Test

sample 1 3

read dummy myvar

...NOTE.. 2 VARIABLES AND 3 OBSERVATIONS STARTING AT OBS 1

* Use SKIPIF to calculate statistics for observations only where variable dummy = 1.
skipif(dummy.eq.1)

...NOTE..OBSERVATION 1 WILL BE SKIPPED
...NOTE..OBSERVATION 3 WILL BE SKIPPED

stat myvar

Name N Mean St. Dev Variance Minimum Maximum
MYVAR 1 4.0000 0.0000 0.0000 4.0000 4.0000

This is easy using the SKIPIF command.

Here is an exampleexample:

sample 1 3
read dummy myvar
1 2
0 4
1 5

* Use SKIPIF to calculate statistics for observations only where variable dummy = 1.
skipif(dummy.ne.1)
stat myvar