When SAS-importing is not working

proc import out=work.test

datafile='C:\sastest\excelfile.xlsx'

dbms=xlsx replace;

sheet='Sheet1';

run;

proc export data=sashelp.class

outfile='C:\sastest\excelfile2.xlsx'

dbms=xlsx replace;

sheet='Sheet2';

run;

Logitech H800 no sound problem

I have to say I spent about an hour trying to figure out how to use it off a PC. It worked immediately for my Samsung phone, but it refused to produce sound off my PC. After internet-searching for solutions, I made it work. Here is how:

a) Go to http://support.logitech.com/en_us/product/wireless-headset-h800and scroll down to "Headset Paring Utility" section
b) Click on download button for get a zipped file "paring_utility_1.00…zip".
c) Unzip it to your local folder (or just to the desktop).
d) Find Pairing.exe and click it to install.
e) Follow instructions that the software tells you. Basically on the headset's right-ear part, you have to find and press the volume up (+) button and the >> button (fast-forward button) at the same time until the green light on the headset begins to blink fast. When this happens, it is communicating with the PC and the Paring software. You have to follow a couple of more instructions on the software while this is happening. The >> button (fast forward button) on the headset may be hard to find, but it is on the left side of the green light.

R Studio

DPLYR is some kind of module that allows efficient data management.

library(dplyr)

 

This keeps rows that has a specified value:

filter(dataname,School=="Ad High School")

x <- filter(dataname,School=="Ad High School")

 

How to derive standard deviation from standard error

Algorithm:

SD=Standard error * sqrt(N);

 

Reference:

http://handbook.cochrane.org/chapter_7/7_7_3_2_obtaining_standard_deviations_from_standard_errors_and.htm

 

QC: I checked the algorithm using SAS.  The result was consistent with the algorithm (i.e., SD=standard error*sqrt(N)).

proc means data=sashelp.class mean std stderr n;
var height;
run;

ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
Mean 62.3368421

SD 5.1270752

Stadard Error 1.1762317

N 19
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

SAS T-test for proportions

data YesNo;
input Gender $ NumYes Total;
Response="Yes"; Count=NumYes; output;
Response="No "; Count=Total-NumYes; output;
datalines;
Men 30 100
Women 45 100
;

proc print noobs;
var Gender Response Count;
run;

proc freq order=data;
weight Count;
table Gender * Response / chisq riskdiff;
exact riskdiff;
run;

Open source softwares

 

–Python 3.5

https://www.python.org/downloads/

–PHP & MySQL (from WampServer)

http://www.wampserver.com/en/

Statistical Analysis Program

–R

https://cran.cnr.berkeley.edu/

–GPower

http://www.gpower.hhu.de/en.html

–Optimal Design

https://sites.google.com/site/optimaldesignsoftware/home

Editing Programs

— NotePad++

https://notepad-plus-plus.org/download/v7.1.html

–Sigil

https://github.com/Sigil-Ebook/Sigil/releases/tag/0.9.6 (There is a link to the exe file at the bottom of the page.

HLM: What happens if I enter level2 variables at level 1?

The goal of this exercise is to find out what happens if I intentionally use a level2 variable at level 1 in HLM.   I found that the coefficients and standard errors remain about the same.  The parameter that differed was just the degree of freedom, which was consistent with my expectation.

Using my old NELS dataset, I ran two different HLM models using Bryk and Raudenbush’s software (See model 1 and model 2 equations in the table below).

  • The URBAN as level 1 covariate model (I entered the level2 variable URBAN wrongly at level 1)
  • The URBAN as level 2 covariate model (I entered the level2 variable URBAN correctly at level 2)

The outcome variable is the achievement composite (POSTTEST), students are level 1 and schools are level 2.  When expressed as mixed models, the two models are identical, which is why I expected most parameters to come out the same.

POSTTESTij = γ00
γ10*URBANij  + u0jrij

The first model (MODEL 1; see below) included URBAN (students are in urban school) as a level 1 predictor.  Of course this is a wrong specification because urban is a school characteristic.  In the second model (MODEL 2), I used it at the expected level, which is at level 2 (school level).

These models look different, but AGAIN when expressed as mixed models, they are identical.  As the third model (MODEL 3), I replicated the same HLM model using SAS PROC GLIMMIX.  SAS requires that the equation be expressed as a mixed model.

Results showed that coefficients and standard errors are more or less the same across three models.  The only one thing that was different was degree of freedom.

Conclusion: As long as variables enter the model as fixed effects as done here, there is nothing magical about the HLM model.  HLM software or SAS PROC GLIMMIX (option ddfm=kr) adjust degree of freedom values, accounting for the fact that URBAN is a school-level variable and thus should not be awarded a value that is too large.  Notice that under the correct specification (MODEL 2 and MODEL 3), the degree of freedom for URBAN is close to the number of schools, not to the number of students.

Thanks for any comments you may have.

MODEL 1 MODEL 2 MODEL 3
URBAN as LEVEL 1 covariate URBAN as level 2 covariate SAS PROC GLIMMIX
Level-1 Model

POSTTESTij = β0j + β1j*(URBANij) + rij

Level-2 Model

β0j = γ00 + u0j
β1j = γ10

Mixed Model

POSTTESTij = γ00
γ10*URBANij  + u0jrij

Level-1 Model

POSTTESTij = β0j + rij

Level-2 Model

β0j = γ00 + γ01*(URBAN_LEj) + u0j

Mixed Model

POSTTESTij = γ00 + γ01*URBAN_LEj  + u0jrij

proc glimmix data=kaz.level1;

class schoolID;

model

posttest =

urban

/solution ddfm=kr dist=normal link=identity s ;

random schoolID;

run;

 

Final estimation of fixed effects
(with robust standard errors)

Fixed Effect  Coefficient  Standard
error
 t-ratio  Approx.
d.f.
 p-value
For INTRCPT1, β0
    INTRCPT2, γ00 52.643432 0.526139 100.056 125 <0.001
For URBAN slope, β1
    INTRCPT2, γ10 -0.450022 1.157924 -0.389 692 0.698

 

Final estimation of variance components

Random Effect Standard
Deviation
Variance
Component
  d.f. χ2 p-value
INTRCPT1, u0 3.76951 14.20923 125 292.48369 <0.001
level-1, r 8.39004 70.39271

Statistics for current covariance components model

 

Final estimation of fixed effects
(with robust standard errors)

Fixed Effect  Coefficient  Standard
error
 t-ratio  Approx.
d.f.
 p-value
For INTRCPT1, β0
    INTRCPT2, γ00 52.643459 0.526140 100.056 124 <0.001
    URBAN_LE, γ01 -0.449983 1.157920 -0.389 124 0.698

 

Final estimation of variance components

Random Effect Standard
Deviation
Variance
Component
  d.f. χ2 p-value
INTRCPT1, u0 3.76919 14.20678 124 292.48068 <0.001
level-1, r 8.39007 70.39334

Statistics for current covariance components model

 

Solutions for Fixed Effects
Effect Estimate Standard Error DF t Value Pr > |t|
Intercept 52.6434 0.5460 95.01 96.41 <.0001
urban -0.4501 1.1095 132.4 -0.41 0.6856
 

 

Covariance Parameter Estimates
Cov Parm Estimate Standard Error
schoolID 14.2150 3.4610
Residual 70.3913 3.7455

 

Datasets:

www.nippondream.com/file/datafiles_HLM.zip

Results from Model 1

Results from Model 2

Results from PROC GLIMMIX

 

Code Academy PHP problem sets

<html>
<p>
<?php
// Create an array and push on the names
// of your closest family and friends
$fam=array();
array_push($fam,"Jeana");
array_push($fam,"Niko");
array_push($fam,"Kaz");
array_push($fam,"Hiroko");
array_push($fam,"Yoko");
print count($fam);
$n_elements=count($fam);
// Sort the list
sort($fam);
// Randomly select a winner!
$roll=rand(1,$n_elements);
print $roll;
$which_person= $array[$roll];
print $which_person;
// Print the winner's name in ALL CAPS
$which_person2=strtoupper($which_person);
print $which_person2;

?>
</p>
</html>

 

 

<html>
<p>
<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$array=array(4,3,2,5);
sort($array);
print join(",", $array);
?>
</p>
<p>
<?php
// Reverse sort your array and print the joined elements to the screen

rsort($array);
print join(",",$array);

?>
</p>
</html>

 

 

http://www.w3schools.com/php/php_echo_print.asp

<!DOCTYPE html>
<html>
<head>
<title>Your own do-while</title>
<link type='text/css' rel='stylesheet' href='style.css'/>
</head>
<body>
<?php
//write your do-while loop below
do {
$roll=rand(1,6);
echo "$roll";
} while ($roll !=6);

?>
</body>
</html>

 

FUNCTIONS

$length=strlen("kazuaki");
print $length;

 

<html>
<p>
<?php
// Get a partial string from within your own name
// and print it to the screen!

?>
</p>
<p>
<?php
// Make your name upper case and print it to the screen:
$myname="Kaz";
$uppercase=strtoupper($myname);
print $uppercase;
?>
</p>
<p>

<?php
// Make your name lower case and print it to the screen:
$lowercase = strtolower($uppercase);
print $lowercase;
?>
</p>
</html>

 

 

 

<html>
<p>
<?php
// Get a partial string from within your own name
// and print it to the screen!
$myname="Kazuaki";
$partial = substr($myname, 0, 3);
print $partial;
?>
</p>

<p>
<?php
// Make your name upper case and print it to the screen:
$uppercase=strtoupper($partial);
print $uppercase;
?>
</p>

<p>

<?php
// Make your name lower case and print it to the screen:
$lowercase = strtolower($uppercase);
print $lowercase;
?>
</p>
</html>

 

 

<html>
<p>
<?php
// Print out the position of a letter that is in
// your own name
$x=strpos("kazuaki","u");
print $x;
?>
</p>
<p>
<?php
// Check for a false value of a letter that is not
// in your own name and print out an error message
if (strpos("kazuaki","x")===false){
print "Sorry, no x in the name kazuaki";
}
?>
</p>
</html>

 

 

<html>
<p>
<?php
// Use rand() to print a random number to the screen
print rand();
?>
</p>
<p>
<?php
// Use your knowledge of strlen(), substr(), and rand() to
// print a random character from your name to the screen.
$length=strlen("kazuaki");
//print $length;
$random_n=rand(1,$length);
//print $random_n;
$random_letter=substr("kazuaki",$random_n-1,1);
print $random_letter;

?>
</p>
</html>

 

 

<html>
<p>
<?php
// Create an array and push 5 elements on to it, then
// print the number of elements in your array to the screen
$fav_food=array();
array_push($fav_food,"Sushi");
array_push($fav_food,"Curry");
array_push($fav_food,"Rice");
array_push($fav_food,"Gyoza");
array_push($fav_food,"Ramen");
print count($fav_food);
?>
</p>
</html>

Data and Statistical Programming downloads

Programming

–Python 3.5

https://www.python.org/downloads/

 

–PHP & MySQL  (from WampServer)

http://www.wampserver.com/en/

 

Statistical Analysis Program

–R

https://cran.cnr.berkeley.edu/

–GPower

http://www.gpower.hhu.de/en.html

–Optimal Design

https://sites.google.com/site/optimaldesignsoftware/home

 

Editing Programs

— NotePad++

https://notepad-plus-plus.org/download/v7.1.html

–Sigil

https://github.com/Sigil-Ebook/Sigil/releases/tag/0.9.6 (There is a link to the exe file at the bottom of the page.

 

 

 

 

PROG GLM syntax — contrasting groups using LSMEANS

proc glimmix data=kaz2.Year2AnalysisSample;
class SCHOOL_NAME grade_level race_cate;
model
&z_post = treat
grade_level
/solution ddfm=kr dist=normal link=identity s ;
random SCHOOL_NAME;
covtest /wald;
lsmeans grade_level / diff;
run;