Commit 87ab6247 authored by Christer Ejsing's avatar Christer Ejsing
Browse files

Delete 01_SAS_ms1_test_code.sas

parent 4f4a73fd
/* ----------------------------------------
Code exported from SAS Enterprise Guide
DATE: Monday, December 25, 2017 TIME: 20:02:09
PROJECT: 01_SAS_ms1_test_code
PROJECT PATH: C:\Users\Christer Ejsing\Desktop\01_SAS_ms1_test_code.egp
---------------------------------------- */
/* Conditionally delete set of tables or views, if they exists */
/* If the member does not exist, then no action is performed */
%macro _eg_conditional_dropds /parmbuff;
%let num=1;
/* flags to determine whether a PROC SQL step is needed */
/* or even started yet */
%let stepneeded=0;
%let stepstarted=0;
%let dsname=%scan(&syspbuff,&num,',()');
%do %while(&dsname ne);
%if %sysfunc(exist(&dsname)) %then %do;
%let stepneeded=1;
%if (&stepstarted eq 0) %then %do;
proc sql;
%let stepstarted=1;
%end;
drop table &dsname;
%end;
%if %sysfunc(exist(&dsname,view)) %then %do;
%let stepneeded=1;
%if (&stepstarted eq 0) %then %do;
proc sql;
%let stepstarted=1;
%end;
drop view &dsname;
%end;
%let num=%eval(&num+1);
%let dsname=%scan(&syspbuff,&num,',()');
%end;
%if &stepstarted %then %do;
quit;
%end;
%mend _eg_conditional_dropds;
/* Build where clauses from stored process parameters */
%macro _eg_WhereParam( COLUMN, PARM, OPERATOR, TYPE=S, MATCHALL=_ALL_VALUES_, MATCHALL_CLAUSE=1, MAX= , IS_EXPLICIT=0);
%local q1 q2 sq1 sq2;
%local isEmpty;
%local isEqual;
%let isEqual = ("%QUPCASE(&OPERATOR)" = "EQ" OR "&OPERATOR" = "=");
%let isNotEqual = ("%QUPCASE(&OPERATOR)" = "NE" OR "&OPERATOR" = "<>");
%let isIn = ("%QUPCASE(&OPERATOR)" = "IN");
%let isNotIn = ("%QUPCASE(&OPERATOR)" = "NOT IN");
%local isString;
%let isString = (%QUPCASE(&TYPE) eq S or %QUPCASE(&TYPE) eq STRING );
%if &isString %then
%do;
%let q1=%str(%");
%let q2=%str(%");
%let sq1=%str(%');
%let sq2=%str(%');
%end;
%else %if %QUPCASE(&TYPE) eq D or %QUPCASE(&TYPE) eq DATE %then
%do;
%let q1=%str(%");
%let q2=%str(%"d);
%let sq1=%str(%');
%let sq2=%str(%');
%end;
%else %if %QUPCASE(&TYPE) eq T or %QUPCASE(&TYPE) eq TIME %then
%do;
%let q1=%str(%");
%let q2=%str(%"t);
%let sq1=%str(%');
%let sq2=%str(%');
%end;
%else %if %QUPCASE(&TYPE) eq DT or %QUPCASE(&TYPE) eq DATETIME %then
%do;
%let q1=%str(%");
%let q2=%str(%"dt);
%let sq1=%str(%');
%let sq2=%str(%');
%end;
%else
%do;
%let q1=;
%let q2=;
%let sq1=;
%let sq2=;
%end;
%if "&PARM" = "" %then %let PARM=&COLUMN;
%local isBetween;
%let isBetween = ("%QUPCASE(&OPERATOR)"="BETWEEN" or "%QUPCASE(&OPERATOR)"="NOT BETWEEN");
%if "&MAX" = "" %then %do;
%let MAX = &parm._MAX;
%if &isBetween %then %let PARM = &parm._MIN;
%end;
%if not %symexist(&PARM) or (&isBetween and not %symexist(&MAX)) %then %do;
%if &IS_EXPLICIT=0 %then %do;
not &MATCHALL_CLAUSE
%end;
%else %do;
not 1=1
%end;
%end;
%else %if "%qupcase(&&&PARM)" = "%qupcase(&MATCHALL)" %then %do;
%if &IS_EXPLICIT=0 %then %do;
&MATCHALL_CLAUSE
%end;
%else %do;
1=1
%end;
%end;
%else %if (not %symexist(&PARM._count)) or &isBetween %then %do;
%let isEmpty = ("&&&PARM" = "");
%if (&isEqual AND &isEmpty AND &isString) %then
&COLUMN is null;
%else %if (&isNotEqual AND &isEmpty AND &isString) %then
&COLUMN is not null;
%else %do;
%if &IS_EXPLICIT=0 %then %do;
&COLUMN &OPERATOR %unquote(&q1)&&&PARM%unquote(&q2)
%end;
%else %do;
&COLUMN &OPERATOR %unquote(%nrstr(&sq1))&&&PARM%unquote(%nrstr(&sq2))
%end;
%if &isBetween %then
AND %unquote(&q1)&&&MAX%unquote(&q2);
%end;
%end;
%else
%do;
%local emptyList;
%let emptyList = %symexist(&PARM._count);
%if &emptyList %then %let emptyList = &&&PARM._count = 0;
%if (&emptyList) %then
%do;
%if (&isNotin) %then
1;
%else
0;
%end;
%else %if (&&&PARM._count = 1) %then
%do;
%let isEmpty = ("&&&PARM" = "");
%if (&isIn AND &isEmpty AND &isString) %then
&COLUMN is null;
%else %if (&isNotin AND &isEmpty AND &isString) %then
&COLUMN is not null;
%else %do;
%if &IS_EXPLICIT=0 %then %do;
&COLUMN &OPERATOR (%unquote(&q1)&&&PARM%unquote(&q2))
%end;
%else %do;
&COLUMN &OPERATOR (%unquote(%nrstr(&sq1))&&&PARM%unquote(%nrstr(&sq2)))
%end;
%end;
%end;
%else
%do;
%local addIsNull addIsNotNull addComma;
%let addIsNull = %eval(0);
%let addIsNotNull = %eval(0);
%let addComma = %eval(0);
(&COLUMN &OPERATOR (
%do i=1 %to &&&PARM._count;
%let isEmpty = ("&&&PARM&i" = "");
%if (&isString AND &isEmpty AND (&isIn OR &isNotIn)) %then
%do;
%if (&isIn) %then %let addIsNull = 1;
%else %let addIsNotNull = 1;
%end;
%else
%do;
%if &addComma %then %do;,%end;
%if &IS_EXPLICIT=0 %then %do;
%unquote(&q1)&&&PARM&i%unquote(&q2)
%end;
%else %do;
%unquote(%nrstr(&sq1))&&&PARM&i%unquote(%nrstr(&sq2))
%end;
%let addComma = %eval(1);
%end;
%end;)
%if &addIsNull %then OR &COLUMN is null;
%else %if &addIsNotNull %then AND &COLUMN is not null;
%do;)
%end;
%end;
%end;
%mend;
/* ---------------------------------- */
/* MACRO: enterpriseguide */
/* PURPOSE: define a macro variable */
/* that contains the file system */
/* path of the WORK library on the */
/* server. Note that different */
/* logic is needed depending on the */
/* server type. */
/* ---------------------------------- */
%macro enterpriseguide;
%global sasworklocation;
%if &sysscp=OS %then %do; /* MVS Server */
%if %sysfunc(getoption(filesystem))=MVS %then %do;
/* By default, physical file name will be considered a classic MVS data set. */
/* Construct dsn that will be unique for each concurrent session under a particular account: */
filename egtemp '&egtemp' disp=(new,delete); /* create a temporary data set */
%let tempdsn=%sysfunc(pathname(egtemp)); /* get dsn */
filename egtemp clear; /* get rid of data set - we only wanted its name */
%let unique_dsn=".EGTEMP.%substr(&tempdsn, 1, 16).PDSE";
filename egtmpdir &unique_dsn
disp=(new,delete,delete) space=(cyl,(5,5,50))
dsorg=po dsntype=library recfm=vb
lrecl=8000 blksize=8004 ;
options fileext=ignore ;
%end;
%else %do;
/*
By default, physical file name will be considered an HFS
(hierarchical file system) file.
*/
%if "%sysfunc(getoption(filetempdir))"="" %then %do;
filename egtmpdir '/tmp';
%end;
%else %do;
filename egtmpdir "%sysfunc(getoption(filetempdir))";
%end;
%end;
%let path=%sysfunc(pathname(egtmpdir));
%let sasworklocation=%sysfunc(quote(&path));
%end; /* MVS Server */
%else %do;
%let sasworklocation = "%sysfunc(getoption(work))/";
%end;
%if &sysscp=VMS_AXP %then %do; /* Alpha VMS server */
%let sasworklocation = "%sysfunc(getoption(work))";
%end;
%if &sysscp=CMS %then %do;
%let path = %sysfunc(getoption(work));
%let sasworklocation = "%substr(&path, %index(&path,%str( )))";
%end;
%mend enterpriseguide;
%enterpriseguide
/* save the current settings of XPIXELS and YPIXELS */
/* so that they can be restored later */
%macro _sas_pushchartsize(new_xsize, new_ysize);
%global _savedxpixels _savedypixels;
options nonotes;
proc sql noprint;
select setting into :_savedxpixels
from sashelp.vgopt
where optname eq "XPIXELS";
select setting into :_savedypixels
from sashelp.vgopt
where optname eq "YPIXELS";
quit;
options notes;
GOPTIONS XPIXELS=&new_xsize YPIXELS=&new_ysize;
%mend;
/* restore the previous values for XPIXELS and YPIXELS */
%macro _sas_popchartsize;
%if %symexist(_savedxpixels) %then %do;
GOPTIONS XPIXELS=&_savedxpixels YPIXELS=&_savedypixels;
%symdel _savedxpixels / nowarn;
%symdel _savedypixels / nowarn;
%end;
%mend;
ODS PROCTITLE;
OPTIONS DEV=ACTIVEX;
GOPTIONS XPIXELS=0 YPIXELS=0;
FILENAME EGSRX TEMP;
ODS tagsets.sasreport13(ID=EGSRX) FILE=EGSRX STYLE=HtmlBlue STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/5.1/Styles/HtmlBlue.css") NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation ENCODING=UTF8 options(rolap="on");
/* START OF NODE: import RESULTS unified */
%LET _CLIENTTASKLABEL='import RESULTS unified';
%LET _CLIENTPROJECTPATH='C:\Users\Christer Ejsing\Desktop\01_SAS_ms1_test_code.egp';
%LET _CLIENTPROJECTNAME='01_SAS_ms1_test_code.egp';
GOPTIONS ACCESSIBLE;
%_eg_conditional_dropds(WORK._001);
PROC SQL;
CREATE TABLE WORK._001 AS
SELECT t1.RAW_ID,
t1.Detector,
t1.Polarity,
t1.'MS dimension'n,
t1.'Fragment name'n,
t1.'Structure information'n,
t1.'Lipid species'n,
t1.'Molecular lipid species'n,
t1.'Lipid class'n,
t1.'MS2 Precursor m/z'n,
t1.'MS2 Activation'n,
t1.'MS3 Precursor m/z'n,
t1.'MS3 Activation'n,
t1.Intensity,
t1.'Target m/z'n,
t1.'Measured m/z'n,
t1.'Applied m/z correction'n,
t1.'Corrected measured m/z'n,
t1.'m/z offset'n,
t1.ppmerror,
t1.'Calibration m/z offset'n,
t1.'Is apex'n,
t1.Adduct,
t1.'Lipid ID'n,
t1.'Lipid category'n,
t1.Conflicts,
t1.Charge,
t1.'C index of lipid species'n,
t1.'DB index of lipid species'n,
t1.'OH index of lipid species'n,
t1.'Sum composition of lipid species'n,
t1.'Sum formula of lipid species'n,
t1.'C index of structure information'n,
t1.'DB index of structure informatio'n,
t1.'OH index of structure informatio'n,
t1.'Sum composition of structure inf'n,
t1.'Sum formula of structure informa'n,
t1.'MS2 collision energy'n,
t1.'MS3 collision energy'n,
t1.'Range ID'n
FROM WORK.RESULTS_UNIFIED t1;
QUIT;
GOPTIONS NOACCESSIBLE;
%LET _CLIENTTASKLABEL=;
%LET _CLIENTPROJECTPATH=;
%LET _CLIENTPROJECTNAME=;
/* START OF NODE: select M data */
%LET _CLIENTTASKLABEL='select M data';
%LET _CLIENTPROJECTPATH='C:\Users\Christer Ejsing\Desktop\01_SAS_ms1_test_code.egp';
%LET _CLIENTPROJECTNAME='01_SAS_ms1_test_code.egp';
GOPTIONS ACCESSIBLE;
%_eg_conditional_dropds(WORK._011);
PROC SQL;
CREATE TABLE WORK._011(label="Query") AS
SELECT t1.RAW_ID,
t1.Detector,
t1.Polarity,
t1.'MS dimension'n,
t1.'Fragment name'n,
t1.'Structure information'n,
t1.'Lipid species'n,
t1.'Molecular lipid species'n,
t1.'Lipid class'n,
t1.'MS2 Precursor m/z'n,
t1.'MS2 Activation'n,
t1.'MS3 Precursor m/z'n,
t1.'MS3 Activation'n,
/* Intensity_before_deisotope */
(t1.Intensity) AS Intensity_before_deisotope,
t1.'Target m/z'n,
t1.'Measured m/z'n,
t1.'Applied m/z correction'n,
t1.'Corrected measured m/z'n,
t1.'m/z offset'n,
t1.ppmerror,
t1.'Calibration m/z offset'n,
t1.'Is apex'n,
t1.Adduct,
t1.'Lipid ID'n,
t1.'Lipid category'n,
t1.Conflicts,
t1.Charge,
t1.'C index of lipid species'n,
t1.'DB index of lipid species'n,
t1.'OH index of lipid species'n,
t1.'Sum composition of lipid species'n,
t1.'Sum formula of lipid species'n,
t1.'C index of structure information'n,
t1.'DB index of structure informatio'n,
t1.'OH index of structure informatio'n,
t1.'Sum composition of structure inf'n,
t1.'Sum formula of structure informa'n,
t1.'MS2 collision energy'n,
t1.'MS3 collision energy'n,
t1.'Range ID'n
FROM WORK._001 t1
WHERE t1.Conflicts = '';
QUIT;
GOPTIONS NOACCESSIBLE;
%LET _CLIENTTASKLABEL=;
%LET _CLIENTPROJECTPATH=;
%LET _CLIENTPROJECTNAME=;
/* START OF NODE: select M+1 data */
%LET _CLIENTTASKLABEL='select M+1 data';
%LET _CLIENTPROJECTPATH='C:\Users\Christer Ejsing\Desktop\01_SAS_ms1_test_code.egp';
%LET _CLIENTPROJECTNAME='01_SAS_ms1_test_code.egp';
GOPTIONS ACCESSIBLE;
%_eg_conditional_dropds(WORK._004);
PROC SQL;
CREATE TABLE WORK._004(label="Query") AS
SELECT t1.RAW_ID,
t1.Detector,
t1.Polarity,
t1.'MS dimension'n,
t1.'Fragment name'n,
t1.'Structure information'n,
t1.'Lipid species'n,
t1.'Molecular lipid species'n,
t1.'Lipid class'n,
t1.'MS2 Precursor m/z'n,
t1.'MS2 Activation'n,
t1.'MS3 Precursor m/z'n,
t1.'MS3 Activation'n,
/* Intensity_before_deisotope */
(t1.Intensity) AS Intensity_before_deisotope,
t1.'Target m/z'n,
t1.'Measured m/z'n,
t1.'Applied m/z correction'n,
t1.'Corrected measured m/z'n,
t1.'m/z offset'n,
t1.ppmerror,
t1.'Calibration m/z offset'n,
t1.'Is apex'n,
t1.Adduct,
t1.'Lipid ID'n,
t1.'Lipid category'n,
t1.Conflicts,
t1.Charge,
t1.'C index of lipid species'n,
t1.'DB index of lipid species'n,
t1.'OH index of lipid species'n,
t1.'Sum composition of lipid species'n,
t1.'Sum formula of lipid species'n,
t1.'C index of structure information'n,
t1.'DB index of structure informatio'n,
t1.'OH index of structure informatio'n,
t1.'Sum composition of structure inf'n,
t1.'Sum formula of structure informa'n,
t1.'MS2 collision energy'n,
t1.'MS3 collision energy'n,
t1.'Range ID'n
FROM WORK._001 t1
WHERE t1.Conflicts = 'M+[13]C';
QUIT;
GOPTIONS NOACCESSIBLE;
%LET _CLIENTTASKLABEL=;
%LET _CLIENTPROJECTPATH=;
%LET _CLIENTPROJECTNAME=;
/* START OF NODE: rename variables */
%LET _CLIENTTASKLABEL='rename variables';
%LET _CLIENTPROJECTPATH='C:\Users\Christer Ejsing\Desktop\01_SAS_ms1_test_code.egp';
%LET _CLIENTPROJECTNAME='01_SAS_ms1_test_code.egp';
GOPTIONS ACCESSIBLE;
%_eg_conditional_dropds(WORK._012);
PROC SQL;
CREATE TABLE WORK._012 AS
SELECT /* Intensity_M1 */
(t1.Intensity_before_deisotope) AS Intensity_M1,
/* ppmerror_M1 */
(t1.ppmerror) AS ppmerror_M1,
/* Conflicts_M1 */
(t1.Conflicts) AS Conflicts_M1,
/* Is apex_M1 */
(t1.'Is apex'n) AS 'Is apex_M1'n,
t1.RAW_ID,
t1.Detector,
t1.Polarity,
t1.'MS dimension'n,
t1.'Fragment name'n,
t1.'Structure information'n,
t1.'Lipid species'n,
t1.'Molecular lipid species'n,
t1.'Lipid class'n,
t1.'MS2 Precursor m/z'n,
t1.'MS2 Activation'n,
t1.'MS3 Precursor m/z'n,
t1.'MS3 Activation'n,
t1.'Target m/z'n,
t1.'Measured m/z'n,
t1.'Applied m/z correction'n,
t1.'Corrected measured m/z'n,
t1.'m/z offset'n,
t1.ppmerror,
t1.'Calibration m/z offset'n,
t1.'Is apex'n,
t1.Adduct,
t1.'Lipid ID'n,
t1.'Lipid category'n,
t1.Conflicts,
t1.Charge,
t1.'C index of lipid species'n,
t1.'DB index of lipid species'n,
t1.'OH index of lipid species'n,
t1.'Sum composition of lipid species'n,
t1.'Sum formula of lipid species'n,
t1.'C index of structure information'n,
t1.'DB index of structure informatio'n,
t1.'OH index of structure informatio'n,
t1.'Sum composition of structure inf'n,
t1.'Sum formula of structure informa'n,
t1.'MS2 collision energy'n,
t1.'MS3 collision energy'n,
t1.'Range ID'n
FROM WORK._004 t1;
QUIT;
GOPTIONS NOACCESSIBLE;
%LET _CLIENTTASKLABEL=;
%LET _CLIENTPROJECTPATH=;
%LET _CLIENTPROJECTNAME=;
/* START OF NODE: Import Data (Results_unified.tab) */
%LET _CLIENTTASKLABEL='Import Data (Results_unified.tab)';
%LET _CLIENTPROJECTPATH='C:\Users\Christer Ejsing\Desktop\01_SAS_ms1_test_code.egp';
%LET _CLIENTPROJECTNAME='01_SAS_ms1_test_code.egp';
GOPTIONS ACCESSIBLE;
/* --------------------------------------------------------------------
Code generated by a SAS task
Generated on Monday, December 25, 2017 at 19:58:32
By task: Import Data Wizard
Source file:
C:\000000_MyStuff\ExpzTeam\ExpzSandra\sE122_3T3_Klemm_run2b_cse\25_
ALEX123_ms1_spectral_data_extraction\Results_unified.tab
Server: Local File System
Output data: WORK.Results_unified
Server: Local
-------------------------------------------------------------------- */
DATA WORK.Results_unified;
LENGTH
RAW_ID $ 20
Detector $ 4
Polarity $ 1
'MS dimension'n $ 2
'Fragment name'n $ 1
'Structure information'n $ 1
'Lipid species'n $ 27
'Molecular lipid species'n $ 1
'Lipid class'n $ 9
'MS2 Precursor m/z'n $ 1
'MS2 Activation'n $ 1
'MS3 Precursor m/z'n $ 1
'MS3 Activation'n $ 1
Intensity 8
'Target m/z'n 8
'Measured m/z'n 8
'Applied m/z correction'n 8
'Corrected measured m/z'n 8
'm/z offset'n 8
ppmerror 8
'Calibration m/z offset'n 8
'Is apex'n $ 4
Adduct $ 8
'Lipid ID'n 8
'Lipid category'n $ 19
Conflicts $ 7
Charge 8
'C index of lipid species'n 8
'DB index of lipid species'n 8
'OH index of lipid species'n 8
'Sum composition of lipid species'n $ 6
'Sum formula of lipid species'n $ 17
'C index of structure information'n $ 1
'DB index of structure informatio'n $ 1
'OH index of structure informatio'n $ 1
'Sum composition of structure inf'n $ 1
'Sum formula of structure informa'n $ 1
'MS2 collision energy'n $ 4
'MS3 collision energy'n $ 4
'Range ID'n $ 77 ;
LABEL
'DB index of structure informatio'n = "DB index of structure information"
'OH index of structure informatio'n = "OH index of structure information"
'Sum composition of structure inf'n = "Sum composition of structure information"
'Sum formula of structure informa'n = "Sum formula of structure information" ;
FORMAT
RAW_ID $CHAR20.
Detector $CHAR4.
Polarity $CHAR1.
'MS dimension'n $CHAR2.
'Fragment name'n $CHAR1.
'Structure information'n $CHAR1.
'Lipid species'n $CHAR27.
'Molecular lipid species'n $CHAR1.
'Lipid class'n $CHAR9.
'MS2 Precursor m/z'n $CHAR1.
'MS2 Activation'n $CHAR1.