• Home
  • About Dominick A. Leone
    • Homepage
  • SAS Code
  • Pubfacts | Pubmed listing
  • ResearcherID
  • ORCID
  • SciENcv
  • NCBI Bibliography

Dominick A. Leone

Dominick A. Leone

Category Archives: Uncategorized

Java (jdk) called by package differs from current system version

15 Saturday Sep 2018

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

Problem: Trying to call library(“xlsx”) throws error message indicating that JDK path cannot be found, but you have Java already installed. Your version is more recent than what the package is expecting. You attempt to update your system/IDE so that calls for JDK now point to the newer version

$ sudo R CMD javareconf

— but you get the following error message

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Issue: (1) Many IDEs and programming language packages rely on differing developer versions than might be installed on your OS. For example,  if you upgraded your Java from 9 to 10, and an R-package (such as ‘rJava’ or ‘XLSX’) was built so as to specifically call on directories with the name “/Library/Java/JavaVirtualMachines/jdk-9.jdk/”. (2) You must have:

  1. install_name_tool
  2. This requires Command Line Tools for Xcode installed/downloaded from Apple

Solution:

  • Ensure you have Java (jdk) installed.

$ java -version

  • Ensure you have Command Line Tools for Xcode — https://developer.apple.com/download/more/
  • Reconfigure R to look at newer jdk locations when asked for older versions. RUN the following command line:

$ sudo R CMD javareconf

  •  QUIT & RESTART RStudio

 

Advertisement

REDCap branching logic error — ‘0’ vs 0

02 Monday Apr 2018

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

Problem:

REDCap “sees” zero differently for branching logic depending on its context:

  • “0” or ‘0’
  • 0 (an integer)

If you use want to branch logic based on the value of a field being zero, use quotes (single or double).  Note: there is not a similar issue with unity (1).

Solution:

Replace

[var] = 0

with

[var] = ‘0’

 

Unix – replace |pipe| with tab in MacOS Terminal

20 Tuesday Mar 2018

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

Problem:

  • MacOS Terminal does not allow use of \t for “tab” delimiter
  • Source file may have one or more separators set as non-tab characters
    • comma ,
    • pipe |
    • etc
  • Functions to read data cannot read/import data if source has multiple different delimiter characters

Solution:

  • Convert source file using sed in terminal (unix) window:
  • Enter tab — <control> v <tab>

sed ‘s/       /|/g’ source_file > destination_file

Rstudio lost connection to git

12 Monday Mar 2018

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

Problem: Git was installed, and after update of MacOS, Rstudio no longer can locate git binary executable. When in Rstudio, the git tab is missing.

Testing:

  1. run git from command line — should not throw error.
  2. run —–> which git

Solution: Make sure you have latest version of xcode installed.

xcode-select –install

Reference: https://apple.stackexchange.com/questions/254380/macos-sierra-invalid-active-developer-path

Thank you cuadraman

 

Adding a ssh key with 2-step authentication enabled

01 Friday Sep 2017

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

  1. Generate public key
    • ssh -keygen -t rsa
    • save as id_rsa
  2. Add new key to existing ssh keys
    • turn off strict checking
      • ssh -oStrictHostKeyChecking=no userid@host.com
    • logout of remote host
    • cat .ssh/id_rsa.pub | ssh userid@host.com ‘cat >> .ssh/authorized_keys’

 

Notes:

  • No passphrase
  • Turn-off strict checking only if attempt without fails

Continue reading →

Merging 2 datasets by a common variable (different name)

12 Sunday Mar 2017

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

When doing outer join (match merge) in SAS by a common variable, and this variable has a different name in each dataset, you must rename the common variable. This can done within one (single) data step:

DATA TTTEMP;

Merge librarynam.dataset1 ( Rename= (common_varOLD1= common_varNEW ) ) librarynam.dataset2 (Rename= (common_varOLD2= common_varNEW) ) ;

BY common_varNEW;

RUN;

Left Outer Join – SAS

12 Sunday Mar 2017

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

 

DATA library.final_dataset ;  /*Match-Merge on Ragon_ID for Left-Outter Join */

Merge librarynam.dataset1 (IN=in_1) librarynam.dataset2 (IN=in_2) librarynam.dataset3 (IN= in_3);

BY uniquevar;

IF in_1 = 1 THEN OUTPUT librarynam.final_dataset ; 

RUN;

Rescaling a psychometric scale to its Standard Deviation (SD)

16 Tuesday Aug 2016

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

 

PROC Means data= <dataset> ;
  VAR <psychometric-var> ;
  OUTPUT Out=<NEW_Dataset> std= <var_SD> ;
RUN;

DATA _null_;
  SET <NEW_Dataset>; 
  CALL Symput ( "sigma",<var_SD> );
RUN;
*** Using newly created macro-variable in a datastep ***;
DATA test2; 
   SET <dataset>;
   <Norm-psychometric-var> = ( <psychometric-var> )/( &sigma );
RUN;
 

How to plot odds ratio in SAS

06 Saturday Aug 2016

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

Proc Logistic data= <dataset> plots (only)= oddsratio ;

Class <outcome_var> <categorical_vars> ;

Model <outcome_var>  (event=last) = SOAS;

RUN;

ORPlot1

Force PROC Import to check more rows

09 Saturday Jul 2016

Posted by Dominick A. Leone in Uncategorized

≈ Leave a comment

Problem: Proc Import will only check the first 20 rows of a spreadsheet to determine the data characteristics (type, length, etc).

Solution: Use GUESSINGROWS= <##> option to change the default (up to 32767).

Example:

PROC IMPORT OUT= WORK.artref
            DATAFILE= “P:\ART refusal\De_ID_Baseline20160430.csv”
            DBMS=CSV REPLACE;
            GETNAMES=YES;
            DATAROW=2;
            GUESSINGROWS=32767;
RUN;
Thank you: Hari Lyer, MPH, Harvard School of Public Health
For further info, see SAS documentation.
–Dominick A. Leone–
← Older posts

Software

  • R Website Beginning page where you can find everything related to R: downloads, extensions, information, and general help

Software

  • R Website

ResearcherID

Create a free website or blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • Dominick A. Leone
    • Already have a WordPress.com account? Log in now.
    • Dominick A. Leone
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...