我应该如何使用stata的comment(///)命令来破解长代码行?

时间:2015-09-09 08:32:48

标签: syntax command comments stata

我正在尝试运行以下带有注释分隔符(///)的Stata代码来分解长行。尽管遵循了手册,但我还是收到了错误消息。有人可以告诉我我做错了吗?

谢谢,

史蒂夫

* SCHEXPR 3: SCHOOL-LEAVER DESTINATIONS

. label variable schexpr3 "School-leaver destinations"

. label define school_leaver 1 "Do nothing" 2 "Get more training or education" ///
  3 "Start work or look for a job" 4 "Start a family" 5 "Go overseas to study" ///
  6 "Go overseas to work" 7 "Go back to my country of birth" 8 "I have no plans"

. label values schexpr3 school_leaver


* SCHEXPR 4: TIMES ABSENT FROM SCHOOL

. label variable schexpr4 "Times absent from school"

. label define absent 1 "Never" 2 "Hardly ever" 3 "About once a week" 4 "Most days" ///
  5 "Every day"

. label values schexpr4 absent

1 个答案:

答案 0 :(得分:0)

您收到了什么错误消息?

代码工作正常:

. label define school_leaver 1 "Do nothing" 2 "Get more training or education" ///
>     3 "Start work or look for a job" 4 "Start a family" 5 "Go overseas to study" ///
>     6 "Go overseas to work" 7 "Go back to my country of birth" 8 "I have no plans"

. 
. label define absent 1 "Never" 2 "Hardly ever" 3 "About once a week" 4 "Most days" ///
>     5 "Every day"

. 
. label list
absent:
           1 Never
           2 Hardly ever
           3 About once a week
           4 Most days
           5 Every day
school_leaver:
           1 Do nothing
           2 Get more training or education
           3 Start work or look for a job
           4 Start a family
           5 Go overseas to study
           6 Go overseas to work
           7 Go back to my country of birth
           8 I have no plans

. 
end of do-file