Some of my SAS program examples. Just samples. They are not really intended to be understood.
But they show what SAS can do to get results.

I still sometimes wonder how other people program. We just don't look at others' program that often.
Maybe it is useful if people sit together and see how other people approach things. Once I sat with a person proficient
with PHOTOSHOP. That really did it for me and helped me greatly.

I think my way of doing things is fine. But it is hard to tell because I don't have a chance to look
at other people's work. What I try to do is this:

a) never use default outputs of statistics procedure because it is hard to see statistics across different
models. Instead I use ODS to manipulate the result data, to the point where things are easy to see.

b) try to make everything dynamic instead of static

c) never save any permanent data (fresh each time)

d) do everything in one syntax file (so I know where things are)

One thing that I am working on right now is that I have not yet used the macro statements that involves
%s, such as %if or %then. I am working on it now.

**Descriptive Statistics of data**

This is what I wrote for my paper with Charles Bidwell, our study of social organiaztion in school using
NELS data. One particular variable of our interest had a lot of missing cases because it was collected from teachers
who had to evaluate NELS students (something extra like this usually have a high level of missing cases). So In addition
to get descriptive statistics separately for boys and girls, I added columns of statsitics for complete NELS data, again separately
for boys and girls. In this way, a reader can see if our analytical samples are different from the full NELS data.

I often do this when getting descriptive statistics. One thing to be careful about is the presence
of categorical variables and interval variables. I think it is better to convert categorical variables into 1-or-0 numeric
variable and then use proc means to get means, which correspond to proportions.

I use standard errors that come from PROC MEANS only for continuous variables. For categorical
variables, I derive a standard error using SD and N that come from PROC means--because proportions use different algorithm
for getting standard errors. I identify which variables are categorical variables by the max and min value
of a variable. That is:

if minimum=0 and maximum=1 then do;

x=(mean*(1-mean));

Std_Error=sqrt(x/(N) );

end;

drop x;

**Compare Subgroup Means**

This combine the results of PROC GLM, PROC MEANS, and PROC TIMEPLOT

**Run lots of PROC MIXED (multilevel linear model) or GLIMMIX (multilevel logistics model)**

When the outcome measure is an interval one, this program runs PROC MIXED. If the outcome is dichotomous,
then it runs GLIMMIX. It creates a table that contains the results while also saving the table in Excel.

**Read data from excel tables (tables rather than data that are neatly stored by straight forward
rows and colums) and create tons of graphics.**

**Run PROC NLMIXED, while at the same time checking descriptive statistics of the variables used in
the model.**

**Syntax**
**Results: Excel workbook will be populated with results.**

RUN WINSTEPS from within SAS