Calcite | Level 5

## SAS code help

SAS syntax processing for tick species distribution, according to the following design:

Dear colleagues; I am beginner SAS software learner. I am in problem to analyze the data of tick species in particular districts collected. I want to analyze the data in linear Poisson distribution or regression according to their fixed effects of sex of ticks of each species in male and female, ticks count in each sample number, tick counts in each district (kebele) and ticks count in each species as per the Generalized linear Model I formulated below.

Please help to design the SAS syntax derive to find the ticks count depending on each species and fixed effects I showed above.

The linear Model:

Yijklmnopqr =  μ + Ki + Sj + Ak + Bl + Cm + Dn + Eo + Fp + Gq + Hr + Is + Hr + Is + Jt + Ku + Nx + Mw + Lv + eijkl

key

Where:-

Yhijklmnopqrstuvwx = response random variable (ticks count)

μ = over all mean

Kh = fixed effect due to hth kebele tick count (h = 1 to 7)(Kebele or district)

Z i = random effect due to ith sample number (S_Nr) (1 to 768)

Sj = fixed effect due to jth sex tick count (male=1, female=0) (SEX)

Ak = random effect due to kth count on species Hyaloma Truncatum

Bl = random effect due to lth count on species Hyaloma rufins

Cm = random effect due to mth count on species Hyaloma Impeltatum

Dn = random effect due to nth count on species Amblyoma Variegatum

Eo = random effect due to oth count on species Ambleoma Hebraem

Fp = random effect due to pth count on species Amblyoma Gemma

Gq = random effect due to qth count on species Amblyoma Cohreans

Hr = random effect due to rth count on species Rhipiciphalus Pulchilis

Is = random effect due to sth count on species Rhipiciphalus Eversti Eversti

Jt= random effect due to tth count on species Rhipiciphalus Appendiculatus

Ku= random effect due to uth count on species Rhipiciphalus Decoloratus

Lv= random effect due to yth count on species Rhipiciphalus Pravus

Mw= random effect due to wth count on species Rhipiciphalus Simus

Nx= random effect due to xth count on species Boophilus

eijklmnopqrstuvwx = random error effect

Here are the keys I used to load on the SAS software; but further so many time I tried but there is no out put.

/* Afar cattle hard ticks (Ixodidae) distribution based on species level in some selected kebeles; Mebrate Genet Gebre */

/* Location area = kebele; Sample number = S_Nr; SEX = sex of the ticks; species Hyaloma Truncatum = H_TR; species Hyaloma Rufins = H_RF*/

/* species Hyaloma Impeltatum = H_IMP; species Amblyoma Variegatum = A_VAR; species Ambleoma Hebraem = A_HEB; species Amblyoma Gemma = A_GM */

/* Amblyoma Cohreans = A_COH; Rhipiciphalus Pulchilis = R_PUL; Rhipiciphalus Eversti Eversti = R_EV; Rhipiciphalus Appendiculatus= R_Ap*/

/* species Rhipiciphalus Decoloratus = R_DEC; species Rhipiciphalus Pravus =  R_PR; species Rhipiciphalus Simus= R_SIM; sub-genus Boophilus = Sub_GB */

DATA KKK;

INPUT KEBELE \$ S_Nr SEX \$ H_TR H_RF H_IMP A_VAR A_HEB A_GM A_COH R_PUL R_EV R_AP R_DEC R_PR R_SIM SUB_GB;

CARDS;

Bokaytu          Sample1          M        0          0          0          0          0          0          0          4            6          0          0          0          0          0

Bokaytu          Sample1          F          0          0          0          0          0          0          0          2            0          0          0          0          0          0

Bokaytu          Sample2          M        0          0          0          11        0          0          0          6            2          0          3          0          0          0

Bokaytu          Sample2          F          0          0          0          7          0          0          0          7            1          0          1          0          0          0

;

Run;

PROC GLM DATA=kkk;
CLASS KEBELE S_Nr SEX BCS AN_VUL UD_SC DEW ABD NEC EA F_T;
model Y = KEBELE S_Nr SEX BCS AN_VUL UD_SC DEW ABD NEC EA F_T;
lsmeans BCS AN_VUL UD_SC DEW ABD NEC EA F_T/pdiff;
ods listing exclude lsmeans diff;
ods output diff=ppp lsmeans=mmm;
run;
%include 'C:pdglm800.sas';
%pdglm800(ppp,mmm,alpha=.05,sort=yes);
RUN;

I want if you please can insert the rest syntax to command the SAS further analysis, based on GLM, linear Poisson distribution of tick counts. I want least square means for kebele, sex and for ticks each species if possible, means, graphs output for each species. ticks counts are subdivided in to not only species but also in to individual sex of each tick. (N.B. : - tick are external parasites on cattle)

Thank you very much for your kind help.

The out put keeps saying:-

159 PROC GLM DATA=kkk;
160 CLASS KEBELE S_Nr SEX BCS AN_VUL UD_SC DEW ABD NEC EA F_T;
161 model Y = KEBELE S_Nr SEX BCS AN_VUL UD_SC DEW ABD NEC EA F_T;
NOTE: The previous statement has been deleted.
162 lsmeans BCS AN_VUL UD_SC DEW ABD NEC EA F_T/pdiff;
ERROR: Effects used in the LSMEANS statement must have appeared previously in the MODEL statement.
NOTE: The previous statement has been deleted.
163 ods listing exclude lsmeans diff;
ERROR: The LISTING destination is not active; no select/exclude lists are available.
ERROR: The LISTING destination is not active; no select/exclude lists are available.
164 ods output diff=ppp lsmeans=mmm;
165 run;

166 %include 'C:pdglm800.sas';
WARNING: Physical file does not exist, C:\Users\user\pdglm800.sas.
ERROR: Cannot open %INCLUDE file C:pdglm800.sas.
167 %pdglm800(ppp,mmm,alpha=.05,sort=yes);
-
180
WARNING: Apparent invocation of macro PDGLM800 not resolved.
NOTE: The previous statement has been deleted.
ERROR 180-322: Statement is not valid or it is used out of proper order.
168 RUN;

WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.

Question2: -

The effects of body condition score and sex on tick burden.

This model is used to study the tick burden effect according to the animal’s sex and body condition score. This means how is the prevalence of ticks (ticks count) on an individual animal as per its sex and body condition score.

GLM Model: -

Yijkl = μ  +  Sk  +  Ul   +  eijkl

Where: -

Yijk = individual observation for tick burden (tick count response variable).

μ  = overall mean for tick burden.

Sk = fixed effect due to kth Sex (1=male, 2=female)

Ul = fixed effect due to nth Body Condition Score (1:lean to 4:conditioned)

eijkl = is a random error.

/* Afar cattle hard ticks (Ixodidae) burden on cattle (predilaction sites) in some selected kebeles; Mebrate Genet Gebre */

/* Location area = kebele; Sample number = S_Nr; SEX =sex of the cattle; BCS = body condition score of the cattle* /

/* predilaction sites: Annu-vulva = AN_VUL; udder-scortum = UD/SC; Dewlap = DEW; Abdomen = ABD; Neck = NEC; Ear = EA */

/* Number of engorged female ticks = F_T; body condition score is scored as: conditioned (cond), Medium, Fair (better), lean (thin) */

DATA KKK;

INPUT KEBELE \$ S_Nr SEX \$ BCS AN_VUL UD_SC DEW ABD NEC EA F_T;

CARDS;

Bokaytu                      Bok1               F          Lean    2          3          0          0          0          0            0

Bokaytu                      Bok2               F          Cond   0           2          1          0          0          0            0

Bokaytu                      Bok3               F          Cond   2          12        2          0          0          1            0

Bokaytu                      Bok4               F          Cond   17        30        0          0          13        0            0

Bokaytu                      Bok5               M        Cond   8          15        12        1          0          1            2

Bokaytu                      Bok6               F          Lean   32        23        3          0          2          4            3

Bokaytu                      Bok7               F          Fair     1          3          0          0          0          2            0

Bokaytu                      Bok8               F          Cond  31        4          2          0          0          24           0

Bokaytu                      Bok9               F          Cond   35        4          0          0          0          12           0

Bokaytu                      Bok10             F          Cond   9          3          8          0          0          5            0

Bokaytu                      Bok11             F          Fair     8          9          0          0          0          3            0

Bokaytu                      Bok12             F          Fair     7          8          3          0          0          31            0

Bokaytu                      Bok13             F          Fair     6          17        3          0          1          24            3

Bokaytu                      Bok14             F          Lean    17        8          1          1          0          9            2

Bokaytu                      Bok15             F          Fair     10        11        0          0          0          1            7

Bokaytu                      Bok16             F          Lean    7          8          0          1          1          18            0

Bokaytu                      Bok17             F          Fair     9          11        4          0          1          17            0

Bokaytu                      Bok18             F          Cond   3          7          3          0          0          9            0

Bokaytu                      Bok19             F          Lean    9          11        17        2          1          18            0

Bokaytu                      Bok20             F          Fair     6          7          2          0          0          0            0

Bokaytu                      Bok21             F          Fair     12        3          2          1          1          0            3

;

Run;

2 REPLIES 2
Super User

## Re: SAS code help

```159 PROC GLM DATA=kkk;
160 CLASS KEBELE S_Nr SEX BCS AN_VUL UD_SC DEW ABD NEC EA F_T;
161 model Y = KEBELE S_Nr SEX BCS AN_VUL UD_SC DEW ABD NEC EA F_T;

--> Maxim 3: Know Your Data. There is no variable Y in kkk, but it is needed for this statement to work.

NOTE: The previous statement has been deleted.
162 lsmeans BCS AN_VUL UD_SC DEW ABD NEC EA F_T/pdiff;
ERROR: Effects used in the LSMEANS statement must have appeared previously in the MODEL statement.

--> since the MODEL statement failed, this is a consequence.

NOTE: The previous statement has been deleted.
163 ods listing exclude lsmeans diff;
ERROR: The LISTING destination is not active; no select/exclude lists are available.
ERROR: The LISTING destination is not active; no select/exclude lists are available.

--> You seem to not have a ODS LISTING statement that opens the destination, or you have a ODS LISTING CLOSE further up in the code that closes it.

164 ods output diff=ppp lsmeans=mmm;
165 run;

166 %include 'C:pdglm800.sas';
WARNING: Physical file does not exist, C:\Users\user\pdglm800.sas.
ERROR: Cannot open %INCLUDE file C:pdglm800.sas.

--> supply the complete path (starting with C:\) to your include file: Using just the drive letter will default to the current working directory.

167 %pdglm800(ppp,mmm,alpha=.05,sort=yes);
-
180
WARNING: Apparent invocation of macro PDGLM800 not resolved.

--> the macro could not be found because the file was not found.

NOTE: The previous statement has been deleted.
ERROR 180-322: Statement is not valid or it is used out of proper order.```
Calcite | Level 5

## Re: SAS code help

Thank you for the help. Not yet I am beginner, I will do my best and post my problem again. I have four problems to be solved and I think they are too elementary. If I will be not able to solve through the hints you sent me again I will post it again.
MEBRATEGENET
Discussion stats
• 2 replies
• 884 views
• 0 likes
• 2 in conversation