A. Usage
- Extract sub-string from a string in Macro
B. Code
%let newvar = %substr(&var., 3, %length(&var.)-2); *Newvar is trimming the first 2 characters off the var;
A journey of a thousand miles begins with the first step.
A. Usage
B. Code
%let newvar = %substr(&var., 3, %length(&var.)-2); *Newvar is trimming the first 2 characters off the var;
A. Multiple Titles/Footnotes
title title2 title3 footnote footnote2 footnote3
B. Alignment: default is center.
justify=
C. Font
f=
D.Bold/Italic
bold italic
E. Font size
h=
F. Example
title1 f='Calibri' h=14pt 'Report Title'; title2 "Report Title1"; title3 "Report Title2"; footnote "Prepared by First Last on %sysfunc(date(),worddate.)"; footnote2 justify=left h=8pt bold "Note:"; footnote3 justify=left h=8pt italic "footnote3";
A. Extract Month, Year information from DateTime.
date=datepart(datetime); year=year(date); month=month(date);
B. Date Value for Date Comparison
C. Age calculation
age = intck('Year', birth, "01JUL&yr."D, 'C');
A. Different Standard Errors
B. Estimate function in the GLM procedure
A. Symptom
The plots stopped showing in the pane when running the R codes. The temporary png file generated in the folder didn’t have the graphic output and the file was not able to be deleted.
B. R Code Caused problem
png(file='Construct.png') subgroup.analysis.mixed.effects(x = m.hksj, subgroups = madata$Construct, plot=TRUE) dev.off
In R use png(file=) and dev.off to generate graphic output in the working directory. The subgroup.analysis.mixed.effect function doesn’t work with this method, hence the output graphic file got stuck.
C. Fix
dev.cur() # to identify output device as "png 4" dev.off() # to identify "null device" so the png file in the folder can be deleted; getOption("device") # to set option to "RStudioGD"
A. Update R through RGui
install.packages("installr") library(installr)
A. R code
install.packages("tidyverse") install.packages("meta") install.packages("metafor") devtools::install_github("MathiasHarrer/dmetar") # if not working, clone the package from github and unzip and install from local devtools::install("C:/dmetar-master/dmetar-master")
B. Error
Error: (converted from warning) cannot remove prior installation of package ‘digest’
C. Workaround