SHAZAM Community
Ask Your Question

Revision history [back]

This code looks correct and seems to work using the following two sample files.

Commands.sha

Data.dif

Perhaps the cause of the problem was inclusion of the variable names in the first line of the file without using the names option.

The resulting output is:

 Welcome to SHAZAM (Double Precision) v11.0 -  JUNE 201 Windows7 PAR=112400
 ...NOTE..CURRENT WORKING DIRECTORY IS: C:\temp\shazam\kamal
 |_SAMP 1 50
 |_Read (Data.dif) week1   X1  / DIF
 ...NOTE..UNIT 88 IS NOW ASSIGNED TO: Data.dif
 ...NOTE..DIF FILE HAS    2 COLUMNS AND    146 ROWS
 ...NOTE..    2 VARIABLES AND       50 OBSERVATIONS STARTING AT OBS       1

 |_SAMP 51 178
 |_Read (Data.dif) week2   X2 / DIF
 ...NOTE..UNIT  88 IS CURRENTLY ASSIGNED TO: Data.dif
 ...NOTE..UNIT 88 IS NOW ASSIGNED TO: Data.dif
 ...NOTE..DIF FILE HAS    2 COLUMNS AND    146 ROWS
 ...NOTE..    2 VARIABLES AND      128 OBSERVATIONS STARTING AT OBS      51

 |_STAT X1  X2  / ANOVA
 NAME        N    MEAN        ST. DEV      VARIANCE     MINIMUM      MAXIMUM
 X1       HAS NO OBSERVATIONS IN SAMPLE RANGE
 X2          128  0.25085E+08 0.26586E+08 0.70682E+15   20000.      0.15845E+09

   DIFFERENCE BETWEEN TWO SAMPLES TESTS:    STATISTIC          D.F.     P-VALUE
 APPROXIMATE    T-TEST OF EQUAL MEANS:       -10.675              127    0.0000
 EQUAL VARIANCE T-TEST OF EQUAL MEANS:      -0.93980              126    0.3491
 F-TEST OF EQUAL VARIANCES:                  0.70682E+15   127     -1    0.0000

                 ANALYSIS OF VARIANCE - OVERALL MEAN=       0.25085E+08
                       SS         DF             MS                 F    P-VALUE
 BETWEEN          0.00000E+00      0.               NaN               NaN    NaN
 WITHIN           0.89766E+17    127.       0.70682E+15
 TOTAL            0.89766E+17    127.       0.70682E+15

This code looks correct and seems to work using the following two sample files.

Commands.sha

Data.dif

Perhaps the cause of the problem was inclusion of the variable names in the first line of the file without using the names option.

The resulting output is:

 Welcome to SHAZAM (Double Precision) v11.0 -  JUNE 201 Windows7 PAR=112400
 ...NOTE..CURRENT WORKING DIRECTORY IS: C:\temp\shazam\kamal
 |_SAMP 1 50
 |_Read (Data.dif) week1   X1  / DIF
 ...NOTE..UNIT 88 IS NOW ASSIGNED TO: Data.dif
 ...NOTE..DIF FILE HAS    2 COLUMNS AND    146 ROWS
 ...NOTE..    2 VARIABLES AND       50 OBSERVATIONS STARTING AT OBS       1

 |_SAMP 51 178
 |_Read (Data.dif) week2   X2 / DIF
 ...NOTE..UNIT  88 IS CURRENTLY ASSIGNED TO: Data.dif
 ...NOTE..UNIT 88 IS NOW ASSIGNED TO: Data.dif
 ...NOTE..DIF FILE HAS    2 COLUMNS AND    146 ROWS
 ...NOTE..    2 VARIABLES AND      128 OBSERVATIONS STARTING AT OBS      51

 |_STAT X1  X2  / ANOVA
 NAME        N    MEAN        ST. DEV      VARIANCE     MINIMUM      MAXIMUM
 X1       HAS NO OBSERVATIONS IN SAMPLE RANGE
 X2          128  0.25085E+08 0.26586E+08 0.70682E+15   20000.      0.15845E+09

   DIFFERENCE BETWEEN TWO SAMPLES TESTS:    STATISTIC          D.F.     P-VALUE
 APPROXIMATE    T-TEST OF EQUAL MEANS:       -10.675              127    0.0000
 EQUAL VARIANCE T-TEST OF EQUAL MEANS:      -0.93980              126    0.3491
 F-TEST OF EQUAL VARIANCES:                  0.70682E+15   127     -1    0.0000

                 ANALYSIS OF VARIANCE - OVERALL MEAN=       0.25085E+08
                       SS         DF             MS                 F    P-VALUE
 BETWEEN          0.00000E+00      0.               NaN               NaN    NaN
 WITHIN           0.89766E+17    127.       0.70682E+15
 TOTAL            0.89766E+17    127.       0.70682E+15
click to hide/show revision 3
Repaired incorrect answer

This code looks correct and seems should be done by specifying NOREWIND on the READ statement to work using prevent the following two sample files.file pointer moving to the start of the file on each READ.

Commands.sha

Data.dif

Perhaps An alternative way is to read the cause 146 rows by 2 columns of data as a matrix and copy the problem was inclusion data to the variables you wish. SHAZAM can then perform STAT on the created vectors. Note that the two variables are of the variable names in the first line of the file without using the names option.

The resulting output is:different length.

read (data.txt) data / rows=146 cols=2
dim x1 50 1 x2 96 1
copy data x1 / frow=1;50 fcol=2;2 trow=1;50 
copy data x2 / frow=51;146 fcol=2;2 trow=1;96
stat x1  Welcome to SHAZAM (Double Precision) v11.0 -  JUNE 201 Windows7 PAR=112400
 ...NOTE..CURRENT WORKING DIRECTORY IS: C:\temp\shazam\kamal
 |_SAMP 1 50
 |_Read (Data.dif) week1   X1 x2  / DIF
 ...NOTE..UNIT 88 IS NOW ASSIGNED TO: Data.dif
 ...NOTE..DIF FILE HAS    2 COLUMNS AND    146 ROWS
 ...NOTE..    2 VARIABLES AND       50 OBSERVATIONS STARTING AT OBS       1

 |_SAMP 51 178
 |_Read (Data.dif) week2   X2 / DIF
 ...NOTE..UNIT  88 IS CURRENTLY ASSIGNED TO: Data.dif
 ...NOTE..UNIT 88 IS NOW ASSIGNED TO: Data.dif
 ...NOTE..DIF FILE HAS    2 COLUMNS AND    146 ROWS
 ...NOTE..    2 VARIABLES AND      128 OBSERVATIONS STARTING AT OBS      51

 |_STAT X1  X2  / ANOVA
 NAME        N    MEAN        ST. DEV      VARIANCE     MINIMUM      MAXIMUM
 X1       HAS NO OBSERVATIONS IN SAMPLE RANGE
 X2          128  0.25085E+08 0.26586E+08 0.70682E+15   20000.      0.15845E+09

   DIFFERENCE BETWEEN TWO SAMPLES TESTS:    STATISTIC          D.F.     P-VALUE
 APPROXIMATE    T-TEST OF EQUAL MEANS:       -10.675              127    0.0000
 EQUAL VARIANCE T-TEST OF EQUAL MEANS:      -0.93980              126    0.3491
 F-TEST OF EQUAL VARIANCES:                  0.70682E+15   127     -1    0.0000

                 ANALYSIS OF VARIANCE - OVERALL MEAN=       0.25085E+08
                       SS         DF             MS                 F    P-VALUE
 BETWEEN          0.00000E+00      0.               NaN               NaN    NaN
 WITHIN           0.89766E+17    127.       0.70682E+15
 TOTAL            0.89766E+17    127.       0.70682E+15
anova

One helpful tip for creating variables from vectors is to use the GENR command. eg.

genr var_x1=x1
genr var_x2=x2