Science topic

# SAS Programming - Science topic

Explore the latest questions and answers in SAS Programming, and find SAS Programming experts.

Questions related to SAS Programming

Does anyone have suggestions on software programs that are good at analyzing data and giving great publishable graphics, software not requiring knowledge of programming languages like in R or SAS programs? Softwares that are freely available for installation and application are of priority. Thank you!

Anyone have a SAS program to process data from the

*Recent Physical Activity Questionnaire (RPAQ)? The MRC lists a STATA syntax (https://www.mrc-epid.cam.ac.uk/physical-activity-downloads/), but I do not use STATA.*Hi!, Everyone! I am a new learner of SAS software. I am reading an article of a study about minority. In the findings of this study, there is a sentence mentioning something as follows:

" A power analysis using MacCallum et al.’s (1996) SAS program indicated that the statistical power of the models were at 0.90."

Here I also attached his conceptual model (Structure Equation medel) of his study. I am wondering how could the author achieved such result (0.90) with SAS software. As you can see in another attached photo, there are lots of items under the main item of power and sample size, such as Anova, t-tests, multiple regression, etc. However, I can't find the item or button, especially for structure equation model or path analysis. May I know if anyone know which item I should choose in order to achieve the statistical power of the model 0.90. Alternatively, if there is no "ready made" menu or direct button when conducting a power analysis for SEM or Path Analysis in SAS. is there any software that I can achieve such result directly or easily ?

I have taken the data from a field trial established to screen the sugarcane varieties for sugarcane grassy shoot diseases(GSD). RCBD with three replicates was used to establish the trial. Standard varieties are not available for GSD. Therefore, comparison and rating will not be possible.

The number of GSD infected clumps (phenotypically) and # of total clumps had been taken as the main data of the trial in the one-month intervals from 1 to 12 months (12 disease counts). Disease incidence was calculated. In addition, yield data were taken.

1. Could you please explain what kind of statistical analysis is suitable for analyzing the data taken here in order to find the varietal response for the GSD by the SAS program based on disease data?

2. What data (# disease clumps or disease incidence) is appropriate to use for analysis? Further, it would be a great support if anyone can give an idea of how to write CLASS and MODEL statements of SAS for analyzing this data.

Thank you

The solution seems quite simple, but I can't find the code that works. I just try to run the following SAS code in RStudio :

proc ttest data=jump_data;

var JFM_BJH;

class clc_sex;

where ageg=2;

run;

ageg = age groups and this categorical variable has 5 levels.

Thank you very much in advance

I’m performing a multivariate regression and my residuals are not normal. I decided to do a log y transformation however this didn’t help should it have or is there another thing I could try?

I have experimented with two Factor: Factor A: Two iron sources and Factor B: two seasons with three blocks. When I run the SAS, the interaction not significant, but the combination of the treatment was significant.

what the problem for this

I have water temperature data for moring and evening, I need to show the maximum and minimum value by the SAS program.

Can anyone inform me of the SAS code for this

Hello SAS recommends to me that I look at the article Fisher, R. A. (1938).

*Statistical Methods for Research Workers*. 10th ed. Edinburgh: Oliver & Boyd. in order to understand how to transform nominal variables by optimally scoring the categories.I tried reading it and it just made me even more confused. Can anyone give me a layman's term on the optimal scale (SAS defines it as optimal score or opscore)?

Is there SAS code for implementing panel cointegration tests?

SAS programming for clinical trails. Filing to NDA (FDA)

my model is related to earnings management.

Hello everyone,

I had successfully installed oracle database 11g XE edition and SAS 9.4 version on a system running on windows 10 Enterprise. I was able to create database through sql-plus or oracle sql developer. I have all required SAS components such as SAS\ACCESS to ORACLE and SAS\ACCESS to ODBC installed.

I had error while trying to connect to database from SAS using

libname myora oracle user='Bakare' password='Agbaman path='XE';

the error message I got is below:

2 libname myora oracle user='Moshood' passoword='Agbaman' path='XE' ;

ERROR: The SAS/ACCESS Interface to ORACLE cannot be loaded. ERROR: Image SASORA found but not

loadable..

Please make sure Oracle environment is set correctly.

Look in the install/Config doc for additional info for your platform.

Other possible reasons - incomplete Oracle client install, 32/64-bit mismatch between Oracle

client & SAS, incorrect Oracle client version(Oracle client must match the version

picked during post-install process), incompatible sasora for your OS or its attribs

don't permit SAS to load it.

ERROR: Error in the LIBNAME statement.

For me, im using sas program and i do and analysis my data personally.

The likelihood ratio test of comparing reduced model with full model differs by fixed factor result to chi-square distribution of zero degree of freedom.

/* reduced model */

proc mixed method = ml;

class block gen;

model rtwt = /ddfm = kr;

random block gen;

run;

/* full model*/

proc mixed method = ml;

class block gen;

model rtwt = prop_hav/ddfm = kr;

random block gen;

run;

There are 3 degree of freedom from reduced model - block variance, genotype variance, and residual variance. The same degree of freedom for full model with includes prop_hav as covariate. The difference in their -2 loglikelihood has zero degree of freedom under chi-distribution. Please could anyone guide me on how to compare these model to ascertain if the full modelis significantly different from reduced model.

I am trying to locate the whereabouts of the specific source code for the SAS program mentioned in the paper below on page 102:

Unfortunately the site is no longer working and the authors are not contactable. If anyone can help, I would be most grateful.

I tried the offset function but it is quite complex. I have 60,000 rows of data from UV detection. I need to offset downwards by +1 for all of them so that only y axis of graphed chromatogram(s) will be affected. If there is a way of manipulating the figure to do this please let me know.

The percentage deviation and multiplication did not work.

I am using excel 2017. If you know Origin it wont matter it is similar. I couldnt download SPSS.

End goal is attached below.

I have a set of forest plots in which for example three have been remesured after three years, another three after five years, two after six years. How can I compare mortality and recruitment fairly among these plots?

Any suggestions or literature please?

I can open program, enter data, write some statement and some analysis but i am not professional I want to apple use SAS program as professional in analysis data of poultry breeding," wights, BWG,egg production traits, blood biochemicals" how calculate Correlation, means, GLM.... whats your advise?

I use SPSS program well at statistical analysis at poultry breeding data, but i am not use SAS program well Are SPSS program do the same analysis of SAS program with accuracy and precision? Most article use SAS.

proc NLIN data = eleven

BEST = 10

MAXITER = 100

METHOD = Gauss

CONVERGE=1.0E-6

LIST

ALPHA = 0.05

OUTEST = outest(where = (_TYPE_ = "COVB"));

parms

B1 = 1

B2 = .5128

B3=-.0036;

model y = B1-B2*exp(-B3*x);

id id x y;

output

out = elevenOut

p = y_hat

r = residual

stdr = SE_Resid

LCLM = LCL_Mean

UCLM = UCL_Mean ;

run; quit; title;

I am trying to calculate the SASA of residue 128 in Lysozymefor a 25 ns trajectory. What should be my calculation group and output group in that case?

I used an incomplete block design (LATTICE) with two replications under stress and control conditions, in some blocks there is covariate factor and I want to correct treatments with covariance analysis but I don't know SAS code.

I appreciate if you help me with that

I will be working with cancer registry data (case level) and area based measures from the census and other sources to do a multilevel regression modeling. There will be thousands, if not tens of thousands, of cases, so considerable computing power is required. I personally have experience with SAS, but have heard STATA requires less memory/space for computation. Which program is preferable for such analysis? What are the pros and cons of each program for this analysis? Would it be useful to learn STATA programming?

Thank you very much in advance.

I could calculate the phenotypic correlation coefficient and generate the correlation matrix with logciel R, now I would calculate the corresponding genetic correlation coefficient but I don't know how.

Which other program can do it

NB: I do not have the SAS program.

thanks

Assuming 12 varieties are evaluated in 4 replicates in Randomized Complete Block Design (RCBD) where 20 variables are measured, is it appropriate to run correlation and principal component analysis on such replicated data or on the mean value of those varieties across the replicates? Which is the better approach? That is, there would 12*4 =48 observations if the analysis is based on replicate values while there would be 12 observations having computed the mean prior to correlation and principal component analysis.

Statisticians. Breeders. Biometricians

I intend to obtain kinship matrix from pedigree data through proc inbreed to be used as input to proc mixed in order to obtain additive genetic variance. The warning message is always "Individual clone=I011412 has been previously defined. Observation 27 corresponding to this individual will

not be processed." How do I order individuals to avoid this warning message?

proc inbreed data=pedigree covar outcov=kinmat;

var clone female male;

run;

In plant breeding, we often talk of estimate of random effect i.e. BLUP and variance component on quantitative variables such as yield, plant height and etc. My thought is that estimate of BLUP or variance component for qualitative trait that are ranked or ordinal is wrong and unreliable. Take for example, if disease severity is scaled from 1 = no symptom to 5 = symptom is extremely severe. This is qualitative trait that is ranked! Is it appropriate to estimate the BLUP or variance component of random effect on such trait?

The 15 farms have new treatments in common but the local variety which is considered to be a check variety varies from one farm to another. There was NO replication of each treatment within a farm. Therefore, each farm is taken as a block in order to estimate block effect and residual term for comparison. Does it make sense to make a pairwise comparison since the local check is unique from one farm to another? The SAS script for the analysis is as follows

proc mixed data=onfarm covtest;

class farm variety;

model fyld=variety nohav/ddfm=satterth; /* nohav is a covariate */

random farm;

lsmeans variety/diff adjust=tukey;

run;

quit;

I have reached my wts end trying to run a PROC NLIN model using SAS on my data set. I got the syntax from a colleague doing similar experiment but i am not sure if the contraints fit into my data.I shall appreciate every effort in putting me through what am doing wrong. Here is my SAS syntax:

DATA ACC;

Input TIME IVGP SPECIES$;

Cards;

2 10.49293325 C1

2 8.32876575 C1

2 5.77111325 C11

2 4.78740075 C11

2 6.16459825 CN2

2 5.37762825 CN2

2 4.78740075 CN21

2 3.60694575 CN21

2 1.83626325 CN3

2 1.04687 CN3

2 3.88116175 CN31

2 3.150835925 CN31

2 8.32876575 U2

2 9.641 U2

2 2.42649075 U21

2 2.62323325 U21

2 9.31247825 U3

2 7.14831075 U3

2 4.19717325 U31

2 6.55808325 U31

2 9.50922075 U1

2 11.87013075 U1

2 7.854721 U11

2 9.0148674 U11

2 12.26361575 CN1

2 10.29619075 CN1

2 5.565580825 CN11

2 5.32876575 CN11

4 15.72311325 C1

4 13.19803575 C1

4 9.83712575 C11

4 8.26318575 C11

4 8.85341325 CN2

4 6.88598825 CN2

4 5.70553325 CN21

4 6.68924575 CN21

4 3.48732 CN3

4 2.34672 CN3

4 6.84022825 CN31

4 6.69674325 CN31

4 10.62409575 U2

4 11.303625 U2

4 5.70553325 U21

4 5.90227575 U21

4 13.57523325 U3

4 12.39477825 U3

4 7.08273075 U31

4 11.41106575 U31

4 16.34591575 U1

4 18.08402325 U1

4 13.6521897 U11

4 14.9912487 U11

4 19.08402325 CN1

4 17.11659825 CN1

4 10.788075 CN11

4 8.16546075 CN11

8 24.95372325 C1

8 22.06773575 C1

8 15.32962825 C11

8 14.77197575 C11

8 15.54265825 CN2

8 12.00129325 CN2

8 9.06644325 CN21

8 11.00129325 CN21

8 8.1297124 CN3

8 7.6971254 CN3

8 9.91856325 CN31

8 8.75439575 CN31

8 18.90356825 U2

8 20.30325 U2

8 11.80455075 U21

8 12.59152075 U21

8 19.87099325 U3

8 19.47750825 U3

8 14.16546075 U31

8 18.49379575 U31

8 23.05144825 U1

8 24.36349575 U1

8 19.87432 U11

8 20.1467912 U11

8 24.19932825 CN1

8 24.00258575 CN1

8 13.45992825 CN11

8 14.28076575 CN11

12 36.5945365 C1

12 35.741124 C1

12 25.051879 C11

12 24.658394 C11

12 26.625819 CN2

12 20.723544 CN2

12 17.640814 CN21

12 17.510514 CN21

12 19.7398315 CN3

12 15.0180115 CN3

12 13.247329 CN31

12 10.6896765 CN31

12 32.773699 U2

12 33.14078 U2

12 23.871424 U21

12 24.264909 U21

12 29.9704415 U3

12 31.347639 U3

12 27.412789 U31

12 32.3313515 U31

12 35.7248365 U1

12 36.4140815 U1

12 29.051879 U11

12 32.2662015 U11

12 36.856429 CN1

12 35.675974 CN1

12 24.788694 CN11

12 23.347639 CN11

24 75.5645465 C1

24 73.500689 C1

24 60.859014 C11

24 60.072044 C11

24 58.6948465 CN2

24 50.234919 CN2

24 48.4466565 CN21

24 49.5143915 CN21

24 50.8251465 CN3

24 46.1033265 CN3

24 45.2837815 CN31

24 43.971734 CN31

24 61.6121165 U2

24 61.198135 U2

24 64.5971215 U21

24 64.006894 U21

24 64.941744 U3

24 63.465529 U3

24 70.696139 U31

24 72.8603065 U31

24 72.335229 U1

24 72.598414 U1

24 64.285074 U11

24 66.2863665 U11

24 74.630989 CN1

24 72.8603065 CN1

24 58.728714 CN11

24 58.267494 CN11

48 144.884779 C1

48 143.2118215 C1

48 117.766889 C11

48 115.832039 C11

48 90.092639 CN2

48 90.5825565 CN2

48 88.8281615 CN21

48 90.666579 CN21

48 84.205359 CN3

48 90.9610465 CN3

48 119.127799 CN31

48 118.9962065 CN31

48 92.844449 U2

48 90.8641775 U2

48 149.162959 U21

48 151.328419 U21

48 131.2819714 U3

48 130.7126745 U3

48 130.177954 U31

48 129.9812115 U31

48 121.521284 U1

48 125.6528765 U1

48 139.2144065 U11

48 141.799464 U11

48 145.017664 CN1

48 143.0789365 CN1

48 122.112804 CN11

48 120.929764 CN11

;

PROC SORT DATA = WORK.ACC;

BY SPECIES;

RUN;

PROC PLOT DATA = WORK.ACC;

BY SPECIES;

PLOT IVGP*TIME;

RUN;

PROC NLIN BEST = 9; BY SPECIES;

PARMS A = 9 TO 15 BY 1

B = 39 TO 44 BY 1

C = 0.03 TO 0.05 BY 0.005;

MODEL IVGP = A + B*(1-EXP(-C*TIME));

OUTPUT OUT = WORK.ACC PARMS = ABC;

RUN;

DATA WORK.ACC;

SET WORK.ACC;

PD = A + B;

ED = A + B*C/(C+0.05);

RUN;

PROC MEANS MEAN NOPRINT DATA = WORK.ACC;

BY SPECIES;

VAR A B C PD ED;

OUTPUT OUT = WORK.ACC MEAN = A B C PD ED;

RUN;

PROC PRINT DATA = WORK.ACC;

RUN;

I have a dataset of 60,000 women with a propensity for vaccination ranging from around -0.5 to 1.5. What is the best way to individually match these women on propensity score in SAS? I know how to do this by creating multiple datasets, but I'm hoping there is a function that could save a lot of time/work?

Which program will be better for analysis of this data. I need help to analyse this data in SAS program or any other program. If any friend provide my example for data preparation and running in SAS program.

I am investigating the impact of a factor on 4 Dependent variables (DVs). Two DVs are following normal distributions, the rest two aren't. One of them is "count" data with the majority being 0s and it follows a Poisson distribution. The other is a "time length" data measured by "days". I know that I can use Poisson regression( or zero-inflated, negative binomial) for univariate analysis on the two variables that do not follow normal distribution. However, I need to do the multivariate analysis first to control the type I error. My question is :" What SAS program that I can use for Multivariate analysis with DVs like these? Is there a generalized method for all types of distributions?"

I have a set of non-stationary variables which are

**not cointegrated**.I want to convert these non-stationary variables into stationary variables. I have tried the following methods (f represents a variable):

1) Augmented Dickey Fuller test using d(f)= lag(f) lag(df)

2) Dickey Fuller test with no intercept d(df)= lag(df)

-Thank you.

These days I use

**SAS mixed model**to compute the variances.( For example, proc mixed data=phe convf=1e-8 maxiter=50; )Through google, I know some R packages, like**lme4**and**nlme**. But I can not get the results like SAS. Now I want to know the corresponding R package having the similar function with SAS mixed model. Thank you very much!I want to normalize my data using log10 in SAS. Please write the related program for me.

Thank you

I need Error SSCP Matrix and SSCP Matrix for var, to calculate selection indices (Smith-Hazel index,.....) in Lattice design, but I don’t know SAS program to calculate them. Can anyone kindly help me for this?

I have a set of data that should be fit by segmented regression. I'm trying to find the breaking point of two models in segmented regression. If x<x0, the model is linear. If x>x0 the model is non linear. At x=x0 the y values of both model must be identical. At x=x0 the slope of both model must be identical too. Please anyone suggest me, how to calculate the best estimation for x0 and its confident interval?

I am developing nutrient index through hyperspectral data. i have SAS package but how can i program Stepwise discriminate, Principle Component Analysis and band to band R square. sent me any model programing

I am working through a SAS database where if an answer to a question was (n/a) values were coded as 99. I was wondering if I can use a quick way to tell SAS to consider 99 as "." where ever SAS sees the number 99. I could of course do it by each variable alone easily using if-then statement, but I am looking for a faster way to do it. I also could use an array statement but the variables names are not uniform (for ex, they are not : dx1, dx2,dx3,dx4....)

I am looking for a more general way, like the one we use in SPSS where we define missing values.

Thanks

I'm trying to run the additive macro (for additive hazards models) written by Alicia Howell and John Klein but it takes longer to run. I'm using SAS 9.3. I always break it after an hour without getting any output. I followed all the steps as per Alicia Howell's paper. It does not show any errors except that I don't get any output. I'm not sure whether to leave it running overnight.

Hi,

I´m using PROC SYSLIN in SAS program to set a system of equations to predict biomass in Acacia spp. My goal is to make a weighted restricted SUR fit (or WRSUR, like Parresol, 1999) as there is correlation between the errors of the equations. I have different equations to predict the biomass of stem, foliage, branches and total biomass, each with different functions of variance, for example:

Biomass

_{(stem)}=a_{0}+a_{1}*(DAC^{2}*H)+εBiomass

_{(branches)}=b_{0}+b_{1}*(DAC^{2}*H)+εBiomass

_{(foliaje)}=c_{0}+c_{1}*(DAC^{2})+εBiomass

_{(total)}=d_{0}+d_{1}*(DAC^{2})+d_{2}*(DAC^{2}*H)+εAnd the equations of the error variance, wich will be used as weights are:

σ

^{2}e(stem)=(DAC^{2}*H)^{1.806},σ

^{2}e (branches)=(DAC^{2})^{1.8744}σ

^{2}e (foliaje)=(DAC^{2}*H)^{1.607}σ

^{2}e (total)=(DAC^{2}*H)^{1.998}DAC=Diameter at the neck of the tree

H=Total tree height

I had no problems with a restricted SUR fit in SYSLIN, the procedure is relatively simple if the restrictions are well established through SRESTRICT. However, it seems that I have problems syntax to perform a WRSUR, since I do not know how to indicate the weights for the corresponding equation. I just know I should define the four weights in the input data set, but then not as assigning weights to each equation corresponding to conduct a weighted restricted SUR fit. Also, I have to define a variance-covariance previously in SYSLIN?. Can anyone help me with the correct syntax?, I appreciate a lot since I`m stuck.

I'm using the GLM procedure to analyze a factorial assay with additional treatment (3x3+1). However, I don't know how to put the additional treatment in the model.

I recently came across this book: http://www.stata.com/bookstore/workflow-data-analysis-stata/

I hear it has good recommendations for any software, but does anyone have a good recommendation for a similar book written specifically for SAS?

I am interested to use contrast and estimate statements between the same fixed-effect values in my mixed model. I know there won't be statistical difference and that the estimate will be zero (0). However, I am interested in the confidence interval estimates. I would like to perform linear contrast/estimate between two groups (i.e., -A +A +B -B, or in other words, -1 +1 +1 -1). Is that possible? How do I do that using SAS (PROC MIXED)?

I am trying to resolve a problem with count data. At the beginning, I fitted a poisson regression model. However, I got under dispersion in my model.

I tried to use a restricted generalized poisson regression model to go on. However, I got the problem with the SAS code. Can anyone propose a suitable SAS procedure in this case?

Having imported the map and data set to SAS, I used CHORO in GMAP to show the points on the different states. Since the polygons are comprised of different states (provinces) located in different zones, the points are shown at wrong locations.

I have used X and Y(UTM), ID in my data set.

Any idea what I am supposed to do to make points appear at the right location? Thank you in advance for any help

What is the best way to deal with quasi-complete separation of data points in a logistic regression?

I used a split plot design with two main plots and two replicates. Within each main plot, I used an 8 x 10 alpha lattice design to assign 79 varieties. I have the data but am facing difficulties to analyze them.

I have a dataset like:

obs name

1 Ram

2 Ram

3 Ram

4 Shyam

5 Shyam etc.

What is the easiest procedure to change/rename the value 'RAM' to 'Sharma' in SAS?

I have a dataset which I want to fit a non-linear model. I've tried hyperbolic and logarithmic models that fitted with the same R Square. But I don't know which one is better. Can anyone help me with that?

Could someone please help me with SAS code for the following problem?

I have 1 patient and 35 observations.

I would like to make 10 sets of 2 observations selected randomly from the full set of 35, then 10 sets of 3 observations selected randomly from the 35, then 10 sets of 4 observations selected randomly from the 35, and so on and so forth until I have say 20 sets of 10 randomly selected observations.

This random selection can also be with replacement.

I see something similar using PROC PLAN (order and treat) but I have an actual dataset and want to apply the random selection to it and not produce a theoretical dataset. This goes beyond my SAS knowledge.

I am modeling time to death, and have a major issue with a competing risk in that the risk of getting another event (besides death or study end) is more common than death or study end. What is the best way to obtain an accurate Hazard Ratio for the effect of my exposure of interest on death, given these competing risks?