analyse eines .txt-files mit Stata oder SPSS

Fragen und Diskussionen rund um die Statistik und deren Anwendung.
Antworten
IloveStatistik
Beiträge: 2
Registriert: 23.07.2011, 22:05

analyse eines .txt-files mit Stata oder SPSS

Beitrag von IloveStatistik »

Hello together

I have a .txt file with about 1Mio! rows.

Sometimes the rows are in the following order (whereas the number of rows between the rows in bold differ):

...
SBLINK R 5261507
5261439 516.4 364.3 9148.0 ... 816.0 -1133.0 48.4 MA.C.TB...BL.
5261441 516.4 364.0 9145.0 ... 799.0 -1135.0
5261443 516.4 363.9 9140.0 ... 817.0 -1171.0
MSG 5261445 Prime 11_fe_ha
5261445 516.7 363.8 9133.0 ... 813.0 -1097.0 49.3 MA.C.TB......
5261447 517.0 363.8 9127.0 ... 818.0 -1144.0 49.9 MA.C.T.LRTB..
EBLINK R 5261507 5261645 140
5261509 . . 0.0 ... . . . .............
5261511 . . 0.0 ... . . . .............
MSG 5261512 Mask 8_ma_ma
5261513 . . 0.0 ... . . . .............
5261515 . . 0.0 ... . . . .............
...

Here I would like to generate an output, that gives me the two parts "...Prime 11_fe_ha" and "...Mask 8_ma_ma" if and only if "...Prime 11_fe_ha" is situated between "SBLINK..." and "EBLINK...".




Sometimes the rows are in the following order (whereas the number of rows between the rows in bold differ):

...
MSG 5261445 Prime 11_fe_ha
5261439 516.4 364.3 9148.0 ... 816.0 -1133.0 48.4 MA.C.TB...BL.
5261441 516.4 364.0 9145.0 ... 799.0 -1135.0 48.7 MA.C.TB...B..
5261443 516.4 363.9 9140.0 ... 817.0 -1171.0 49.3 MA.C.TB.....R
SBLINK R 5261507
5261445 516.7 363.8 9133.0 ... 813.0 -1097.0 49.3 MA.C.TB......
5261447 517.0 363.8 9127.0 ... 818.0 -1144.0 49.9 MA.C.T.LRTB..
EBLINK R 5261507 5261645 140
5261509 . . 0.0 ... . . . .............
5261511 . . 0.0 ... . . . .............
MSG 5261512 Mask 8_ma_ma
5261513 . . 0.0 ... . . . .............
5261515 . . 0.0 ... . . . .............
...

Here I would like to generate an output, that consists of the two parts "...Prime 11_fe_ha" and "...Mask 8_ma_ma" if and only if "SBLINK..." is situated between "... Prime 11_fe_ha" and "...Mask 8_ma_ma". The place of the "EBLINK..." is not important. that means also the following structure should lead to the same output:

...
MSG 5261445 Prime 11_fe_ha
5261439 516.4 364.3 9148.0 ... 816.0 -1133.0 48.4 MA.C.TB...BL.
5261441 516.4 364.0 9145.0 ... 799.0 -1135.0 48.7 MA.C.TB...B..
5261443 516.4 363.9 9140.0 ... 817.0 -1171.0 49.3 MA.C.TB.....
SBLINK R 526150
5261445 516.7 363.8 9133.0 ... 813.0 -1097.0
5261447 517.0 363.8 9127.0 ... 818.0 -1144.0 49.9 MA.C.T.LRTB..
5261509 . . 0.0 ... . . . .............
5261511 . . 0.0 ... . . . .............
MSG 5261512 Mask 8_ma_ma
5261513 . . 0.0 ... . . . .............
5261515 . . 0.0 ... . . . .............
EBLINK R 5261507 5261645 140
...


can someone give me a advice how I could manage this task?

thanks

best
drfg2008
Beiträge: 2391
Registriert: 06.02.2011, 19:58

re

Beitrag von drfg2008 »

Gab es hier keine Lösungen?

http://r.789695.n4.nabble.com/analizing ... 89025.html

http://comments.gmane.org/gmane.comp.la ... ral/235745

http://www.gomatlab.de/sort-txt-file-wi ... 19152.html

http://www.mail-archive.com/r-help@r-pr ... 41538.html
Hello

My problem is that I have no clue about MATLAB. But I heard at university that MATLAB should be able to do stuff like this. So far I just did some applications in excel, but this is a unappropriate task due to the limit of about 70'000 rows.
Dazu braucht man schon einige Kenntnisse der SPSS-Syntax. Und vor allem sollte man angeben, was überhaupt aus dem txt-file extrahiert werden soll. Dann müsste man mehr Informationen über die Systematik des Files wissen.

Das Problem wäre jedenfalls in SPSS lösbar. Sicherlich leichter als dies bei C++ oder R oder Matlab möglich wäre.

Gruß
drfg2008
IloveStatistik
Beiträge: 2
Registriert: 23.07.2011, 22:05

Beitrag von IloveStatistik »

Danke für den Tipp.

Habe einfach gedacht, dass es evt. ein paar wenige Befehlskombinationen gibt (in MATLAB, R und ähnlichem), welche dafür verständlich und leicht anwendbar wären, so wie bei Excel wenn man Dinge wie =Wenn() und =Suchen() kombiniert...

aber gut dann schaue ich mal was ich mit SPSS auf die Beine stellen kann,, damit kenne ich mich schon ein bisschen aus.
Anzeige:Statistik und SPSS: Die besten Bücher
Als Buch oder E-Book - Jetzt bestellen
spss datenanalyse
SPSS - Moderne Datenanalyse - Jetzt bestellen!
statistik datenanalyse
Statistik - Der Weg zur Datenanalyse - Jetzt bestellen!
Antworten