stata 如何處理文字資訊進行賦值?

時間 2021-06-01 23:14:22

1樓:Gloud

When I see a do-file with a number of very similar statements, I know that the author』s first language was not Stata. A construct such as

generate newcode = 1 if oldcode == 11

replace newcode = 2 if oldcode == 21

replace newcode = 3 if oldcode == 31

...suggests to me that the author should read help recode. See below for a way to automate a recode statement.

A number of generate functions can also come in handy:inlist( ), inrange( ), cond( ), recode( ), which can all be used to map multiple values of one variable into a new variable.

2樓:Z YoY

一直都用英文版,不知道stata中文認不認不好意思啊。。

假設你那個醫療機構名稱的變數叫name

新變數叫 new

gen new=.

replace new=1 if regexm(name,"醫院")replace new=0 if regexm(name,"疾控")就可以啦~~要具體知識的話就搜尋regular expression :)

不過要注意會不會有的機構名稱既包含「醫院」 又包含「疾控」咯

如何處理十萬級別的資料資訊?

要我的話就結構陣列 二分法了 滑稽 當然map hash都可以,最方便的還是寫個xml json,然後上VSCode ctrl F,找到人工讀出來 easy 模式 建一千個資料夾,每個資料的主鍵算個hash,對1k取餘,放進相應的資料夾裡。檔名是hash,內容是記錄。其實就是充分利用檔案系統。har...

通過MVVM進行iOS開發中,如何處理網路請求?

Martin Jack 首先明確一點 沒有使用 ReactiveCocoa,也可以實現 MVVM 架構方式.分別解釋 MVVM 在 iOS 架構方式中的作用 M Model 層,資料層,這裡做一些對基礎實體的定義,資料的遠端獲取,對本地資料的操作等 V View 層,檢視展示層,有些人傾向於將 Vi...

大腦是如何處理文字背後的意思的,也就是那個「懂」的感覺是怎麼來的?

來生為樹 你提了乙個問題,我們所有的答案都得在你提的這個問題所 設定 的範圍裡面,否則就是 答非所問 或者 答不涉題 你寫的是文字,表達的就是乙個抽象的概念,而我們所有看到這個問題並作答的人,是多多少少覺得理解了這個概念,並用文本來表達觀點和思路。也會有兩種人路過,一種是怎麼也理解不了你要問什麼,一...