Know How:BusinessIntelligence:Tipps
Hauptseite > Know How > Business Intelligence > SAS > Tipps
Inhaltsverzeichnis |
SAS Libraries
Relative Pfadangaben
Um bei der Pfadangabe einen "langen" Pfad zu vermeiden (weil das Fenster zu klein ist, um diesen anzuzeigen, kann man auf Variablen zugreifen.
- In der Konfigurationsdatei (z. B. SASApp/sasv9.cfg) eine Variable setzen
-SET PROJROOT "C:\Data\Proj"
- Beim Einrichten der Bibliothek als Pfad diese Variable verwenden (manuell eingeben)
!PROJROOT\Data
Unbalanced Strings
Sometimes you have been typing away in the Editor window of a SAS session, and only after submitting your code it becomes clear that you must have unbalanced quotes somewhere. But where, and was it a single or double quote? It is often difficult to correct that. Since long there has been a 'magic string', and it is still useful. If you have been using Enterprise Guide you may have seen it already, because also there it is put into the code just to make sure. Here it is:
;*';*";*/;quit;*%mend;
Kommandozeile
SAS-Programm direkt ausführen
Hier gibts Informationen darüber: [1]
Systemkommando ausführen
Hier gibts Informationen darüber: [2]
%let cmd = "ls -al";
filename command pipe "&cmd";
data result;infile command truncover;input value $ 1-80;
run;quit;
Externe Dateien
CSV Datei importieren
Importieren einer CSV-Datei mit den Feldnamen in der ersten Zeile [3]
filename in '<name der eingabedatei>';
%let dsname=sp_cdfg; * SAS file name;
%let length=sp_code $ 10; * need to define string length of character data (if any);
data _null_
infile in;
infile in obs=1;
input header:$;header=translate(header, ' ' , '","');
call symput('vars',header);
run;data out.&dsname.;
length &length.;
infile in
delimiter=','end=eofprint
firstobs=2; * if empty values at end of line then use missover;
input &vars.;
run;