erst einmal herzlichen Dank an Jan und Dennis für die schnellen Antworten - ich habe nun versucht, die Selektion in eine Abfrage einzubauen, leider erfolglos. Auch der Weg über einen Stored Process führte nur zu Fehlermeldungen (DAT_STD ist als Datum formatiert):
71 PROC SQL;
72 CREATE TABLE WORK.SORTIERT_VERT_STAND AS
73 SELECT t1.DAT_STND,
74 t1.VNR,
75 t1.PZ_VNR,
76 t1.'AG GEB'n,
Das SAS System
77 t1.AG_BEZ,
78 t1.BSSEU,
79 t1.SALDOIST,
80 t1.RSB,
81 t1.ABDAT,
82 t1.KUENDDAT,
83 t1.ZUTDAT,
84 t1.ZUST,
85 t1.Zustand,
86 t1.TARIF,
87 t1.PRODNR,
88 t1.'Bezeichnung kurz'n,
89 t1.PZSTRUK,
90 t1.PZVERTR,
91 t1.abstruk,
92 t1.ABVERTR,
93 t1.GEBDAT,
94 t1.BERUF,
95 t1.FAMSTD,
96 t1.IHNR,
97 t1.VNR1
98 FROM WORK.FILTER_FOR_BEST_BS_HIST_0001 t1
99 ORDER BY t1.VNR,
100 t1.DAT_STND DESC;
bis hierher wurde der Code durch das System erzeugt, wirft aber trotzdem eine Fehlermeldung aus
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
nach der Sortierung wollte ich eigentlich die Selektion vornehmen, aber auch hier erhalte ich nur eine Fehlermeldung
101
102 CREATE TABLE NEUSTE_VERTRAEGE AS
103 SELECT t1.VNR
104 ,MAX(t1.DAT_STND) AS t1.DAT_STND FORMAT=DDMMYYP10.
_
22
76
ERROR 22-322: Syntax error, expecting one of the following: eine Zeichenkette in Hochkommata, ',', AS, FORMAT, FROM, INFORMAT, INTO, LABEL, LEN, LENGTH, TRANSCODE.
ERROR 76-322: Syntax error, statement will be ignored.
105 FROM WORK.FILTER_FOR_BEST_BS_HIST_0001 t1
Das SAS System
106 GROUP BY t1.VNR;
107
108 QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROZEDUR SQL used (Total process time):
real time 0.02 seconds
cpu time 0.00 seconds
109 /* --- Ende des Codes für "Filtern und sortieren1". --- */
Ach es gibt extra einen neuen Betreff. Hier dann nochmal.
Beim zweiten SQL schreibst du:
,MAX(t1.DAT_STND) AS t1.DAT_STND
nach dem AS musst du das t1. entfernen:
,MAX(t1.DAT_STND) AS DAT_STND
Der erste SQL sieht soweit richtig aus. Da liegt das wahrscheinlich an der Prozedur davor.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.