Download presentation
Presentation is loading. Please wait.
Published byYulia Lesmono Modified over 6 years ago
4
Modify the Macro Put legend of the figure
Change the figure screen size Format the rate with 2 decimals Refine title of table and figure by the caption of variable (not the variable name, such as edu) Change the x-axis to real years Flexible on generating any years report
5
Issues: WARNING: Apparent invocation of macro BOXPLOT not resolved.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of this is a possible data integrity problem. Data allstas – change label 1,2,3 to real levels Two decimal for rate Create Legend Automatic run Matlab and latex
6
4 corrections proc sql; create table _sta&year as
select " "||L.&predictor length=9, sum(bvs.total) as totn, sum(bvs.&outcome) as outn from fl.s&year as bvs LEFT JOIN fl.VARLEVELS as L ON bvs.&predictor = L.level group by L.&predictor union select "Statewide" as &predictor, sum(total) as totn, sum(&outcome) as outn from fl.s&year; create table sta&year as select *, round(outn/totn*100,0.01) as rate from _sta&year; Corrections: - real levels - round up rate with 2 decimals - use _sta&year to solve a warning - WHY: - length=9 - " "||L.&predictor - _sta&year
7
Matlab legend bar(rand(5,2)); s={'Male','Female'};
legend(s,'Location','SouthOutside','Orientation','horizontal');
8
Legend data _NULL_; file "&outputfile..m"; /*Overwrite old file (no option mod)*/ put "function main"; put; put "draw_all;"; put; put "function draw_one(x, figfilename, s)"; put; put '%bar chart '; put "y=x';f1=bar(y(:,[3:3:size(y,2)]));"; put "legend(s,'Location','SouthOutside','Orientation','horizontal');"; put "set(gcf, 'PaperPosition', [ ]);"; put "set(gcf, 'Position', [ ]);"; put "print(gcf, '-deps', figfilename);close(gcf)"; put; put "function draw_all"; put;
9
Legend proc sql; create table _aaa_ as select distinct &predictor from allstas; select compress("'"||&predictor||"'") into :slegend separated by "," from _aaa_; data _NULL_; set allstas end=final; file "&outputfile..m" MOD; tab=" "; if _N_=1 then do; put "x=["; end; put &allyeardata; if final then do; put "];";put; put "draw_one(x, 'fig&outcome.&predictor..eps', {&slegend});"; put; run;
10
Table column’s head %MACRO data2latex (data, varlist, outputfile, caption); %local i; %let vartab=; %let vartabhead=; %let i=1; %let thisvar=%scan(&varlist, &i); %let cccs=c; %do %until (AA&thisvar=AA); %let vartab=&vartab &thisvar tab; %if %substr(&thisvar,1,3)=sta %then %let thisyear=%substr(&thisvar,4,4); %else %let thisyear=&thisvar; %let vartabhead = &vartabhead "&thisyear" tab; %let i=%eval(&i+1); %let cccs=&cccs c; %end; ……………………..
11
X-Label (eg ) data _NULL_; file "&outputfile..m"; /*Overwrite old file (no option mod)*/ put "function main"; put; put "draw_all;"; put; put "function draw_one(x, L, figfilename, s)"; put; put '%bar chart '; put "y=x';f1=bar(L, y(:,[3:3:size(y,2)]));"; put "legend(s, 'Location','SouthOutside','Orientation','horizontal');"; ………………. …………………………………………… if final then do; put "];";put; put "draw_one(x,[&startYear:&endYear], 'fig&outcome.&predictor..eps', {&slegend});"; put; end; run; %mend dostats;
12
Issues an operating-environment command from within a SAS session
In a windowing session, the X command works exactly like the X statement except that you issue the command from a command line. You submit the X statement from the Program Editor window. The X statement is similar to the SYSTEM function, the X command, and the CALL SYSTEM routine. In most cases, the X statement, X command or %SYSEXEC macro statement are preferable because they require less overhead. However, the SYSTEM function can be executed conditionally. The X statement is a global statement and executes as a DATA step is being compiled.
13
Matlab-List of Startup Options for Windows Platforms.
Description /c licensefile Set LM_LICENSE_FILE to licensefile. It can have the form /logfile logfilename Automatically write output from MATLAB to the specified log file. /minimize Start MATLAB with the desktop minimized. Any desktop tools or documents that were undocked when MATLAB was last closed will not be minimized upon startup. /nosplash Start MATLAB without displaying the MATLAB splash screen. /r MATLAB_file Automatically run the specified MATLAB M-file, either commands supplied with MATLAB or your own M-files, immediately after MATLAB starts. This is also referred to as calling MATLAB in batch mode. Separate multiple commands with commas or semicolons (;). M-files must be on the MATLAB path or in the MATLAB startup directory. Do not include the pathname or a file extension.
14
Matlab - List of Startup Options for UNIX Platforms.
Description -h or -help Display startup options (without starting MATLAB). -logfile log Automatically write output from MATLAB to the specified log file. -nodesktop Start MATLAB without bringing up the MATLAB desktop. Use this option to run without an X-window, for example, in VT100 mode, or in batch processing mode. Note that if you pipe to MATLAB using the > constructor, the nodesktop option is used automatically. With nodesktop, you can still use most development environment tools by starting them via a function. For example, use preferences to open the Preferences dialog box and helpbrowser to open the Help browser. Do not use nodesktop to provide a command line interface. If you prefer a command line interface, select Desktop > Desktop Layout > Command Window > Only. -nosplash Start MATLAB without displaying the splash screen during startup. -r MATLAB_command Automatically run the specified MATLAB M-file, either commands supplied with MATLAB or your own M-files, immediately after MATLAB starts. This is also referred to as calling MATLAB in batch mode. Separate multiple commands with commas or semicolons (;). M-files must be on the MATLAB path or in the MATLAB startup directory. Do not include the pathname or a file extension.
15
Automatic Run Matlab and Latex
x '"C:\Program Files\MATLAB71\bin\win32\MATLAB.exe" -r "cd c:\; a; exit;"'; x 'cmd.exe /C "cd c:\ && latex c:\a.tex && dvipdfm c:\a.dvi"'; /*x 'cmd.exe /K "cd c:\ &&latex c:\a.tex&&dvipdfm c:\a.dvi"';*/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.