Know How:BusinessIntelligence:Tipps

Aus Ralph's Wiki
Wechseln zu: Navigation, Suche

Hauptseite > Know How > Business Intelligence > SAS > Tipps

SAS
Allgemeines GlossarDokumentation
Themen SicherheitInstallationKonfigurationAdministrationTroubleshooting
Links ImportExportMacro
Solutions Risk Dimensionsxxx
Tipps MetadatenMakrosJavaNETJSPDATA StepSQLRegExpHashFormateInformation Maps
Tipps:Reporting WebReportStudioInformation Maps
ODS AllgemeinPROC TEMPLATELinks
Internationalization AllgemeinKonfiguration

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]

  1.    %let cmd = "ls -al"; 
  2.    filename command pipe "&cmd"; 
  3.    data result; 
  4.       infile command truncover; 
  5.       input value $ 1-80; 
  6.       run; 
  7.    quit;

Externe Dateien

CSV Datei importieren

Importieren einer CSV-Datei mit den Feldnamen in der ersten Zeile [3]

  1. filename in '<name der eingabedatei>';
  2.  
  3. %let dsname=sp_cdfg;     * SAS file name;
  4. %let length=sp_code $ 10; * need to define string length of character data (if any);
  5.  
  6. data _null_
  7.    infile in;
  8.    infile in obs=1;
  9.    input header:$;
  10.    header=translate(header, ' ' , '","');
  11.    call symput('vars',header);
  12. run;
  13.  
  14. data out.&dsname.;
  15.    length &length.;
  16.    infile in 
  17.           delimiter=','
  18.           end=eof 
  19.           print 
  20.           firstobs=2; * if empty values at end of line then use missover;
  21.    input &vars.;
  22. run;
Meine Werkzeuge